我有一张表Identity(id, super_identity_id)
和一张表Conversation(id, identity_id)
多个身份可以引用相同的super_identity
。
说我有identity A
,我想得到所有conversations
A
super_identity
A
identity
与super_identity
A
人
醇>
我能做的最好的事情是
select
i.id,
i.super_identity_id
from identities i
left join identities ii on ii.super_identity_id = i.super_identity_id
where ii.id = 133
但上述内容并不尊重(2)
有什么想法吗?
答案 0 :(得分:0)
select
i.id,
i.super_identity_id
from identities i
inner join identities ii on ii.super_identity_id = i.super_identity_id and ii.id = 133