How to get data from sql and test the result

HI Users,
I have a task in which i need to execute two sqls. in the way that i have to execute 1st sql and check the data for empty or not and execute the 2md query based on the conditions.
I have created a controller and two repositories but i dono how to handle the data and check the condition and execute the second query. i am using play framework.

code try 1 controller.scla=>

  class NewBillingMonthController @Inject() (implicit cacheService: CacheService, repository: 
   NewBillingRoleRepository, repotosecondquery:UserNewBillingRepository, contexts: Contexts,
   securityService: SecurityService) extends BaseController {

   def getAll(implicit queryParams: QueryParams): Action[AnyContent] = securityService.authenticate() { implicit request =>
    withErrorRecovery { req =>
    toJson{

    repository.getAll(request.user.loginName)
   // repotosecondquery.getrepo()

  }
}

}

   def getAlluser(implicit queryParams: QueryParams): Action[AnyContent] = securityService.authenticate() { implicit 
   request =>
  withErrorRecovery { req =>
  toJson{
     //repository.methodtotestresult()
    //repository.getAll(request.user.loginName)
       repotosecondquery.getrepo()

But getting error while sbt start => as it says ambiguous implicit values:
and i have two repos and i dont know how to write a method to check the 1st sql query data is empty or not and then how to call that method to execute the second query
can any one help me out here!! I am stuck in the code