I have a val employees: List[Employee] and I need to query a table in a performant way, around these lines:
employees.foreach(employee => Select etable.id from employees_salary etable
where etable.id == employee.id and etable.salary < 50000)
I want to filter val employees who have salary < 50000 but I want to fire one single query to database using squeryl. As I am still learning squeryl, don't know how to do this. Your help is much appreciated. Thanks in advance for help
Assuming
employeesis your table mapping, ie:org.squeryl.Table[Employee], then you would just need to use squeryl's query syntax. In your case, ,it would look something like this:You can call
toListon the above if you need the resultset as aList[Employee]