Reputation: 6005
So I have this sql(part of a much larger query):
from Person p left join ForeignCredentials fc on fc.person_id = p.id and fc.type = 'FACEBOOK'
and I'm trying to represent this in scalalikejdbc like this:
select.from(Person as p).leftJoin(ForeignCredential as fc).on(fc.`person_id`, p.id)
But I can't figure out how to ad the extra condition. The intuitive way would be:
select.from(Person as p).leftJoin(ForeignCredential as fc).on(fc.`person_id`, p.id)
.and.eq(fc.`type`, "FACEBOOK").
So how do I do it?
Upvotes: 3
Views: 557
Reputation: 1877
The following should work for you.
on(sqls.eq(fc.`person_id`, p.id).and.eq(fc.`type`, "FACEBOOK"))
Upvotes: 3