I hope someone can help. What I'm attempting to do is probably easy, but I cannot figure it out.
I want to join on MULTIPLE conditions when I do a join (left, inner, whatever).
I cannot get the sql to look correct. In the below scenario, I would like to have multiple conditions met in order for the left outer join to come back with any data, but whenever I use a WHERE or AND clause post the LeftOuterJoin it just doesn't format the actual sql correctly. This is for MySql.
.LeftOuterJoin(Usersetting.UserIdColumn, Friendmap.FriendUserIdColumn) // this works
.LeftOuterJoin(Usersetting.UserIdColumn, Friendmap.FriendUserIdColumn).And(Usersetting.Columns.SettingId).IsEqualTo(5) //does NOT work
.LeftOuterJoin(Usersetting.UserIdColumn, Friendmap.FriendUserIdColumn).Where(Usersetting.Columns.SettingId).IsEqualTo(5) //does NOT work
Again, the latter two examples always append a where after the join has happened -- and I expect the sql to look like this:
...left outer join `usersetting` on `usersetting`.`userid` = `friendmap`.`frienduserid` and `usersetting`.`settingid` = 5
but it always ends up like this:
...left outer join `usersetting` on `usersetting`.`userid` = `friendmap`.`frienduserid`
where `usersetting`.`settingid` = 5
Any help?? I would love to hear it. Thanks so much.