34,587
社区成员
发帖
与我相关
我的任务
分享
--建议改用exists
select id from BhB t1
where exists (select bh from bhb t2 where t2.bh=t1.bh
and exists(select 1 from bhb b3 where t2.glid=t3.glid and bh='10838318'))
select id from BhB where Bh in (
case when(select distinct glid from bhb where bh='10838318')=0
then (select distinct bh from bhb where bh='10838318')
else (select distinct bh from bhb where glid=(select distinct glid from bhb where bh='10838318'))
end)