考虑一下我有下表:
Id | sid | email
___________________________________________________
1 | 10 | [email protected]
2 | 11 | [email protected]
3 | 10 | [email protected]
4 | 10 | [email protected]
5 | 12 | [email protected]
我想通过传递已知的“电子邮件”来查询具有相同“ sid”的所有行,因此,如果我将电子邮件作为“ [email protected]”传递,它将返回ID号为1、3和4的行。
尝试这个 :
select * from yourtable a
inner join (
select sid
from yourtable
where email = "[email protected]"
) b on b.sid = a.sid
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句