sql - mysql left outer join with two conditions -
i have 2 tables, 1 user info , 1 oauth info.
i'm allowing people have multiple oauth logins per user account - have oauth table has:
id|provider|identifier|userid
i can't figure out query need, need use table find of user data have userid.
so if know provider , identifier info, can use userid on row, join on rest of data , log user in. need left join or similar?
a left join
return rows if no match found. since doesn't make sense log on not user, inner join
more appropriate. inner join
default type, , can omit it:
select * oathlogins ol join users u on u.id = ol.id ol.provider = 'sesame street' , ol.identifier = 'bert'
Comments
Post a Comment