select a.slsh,a.sxsdh from 主表 a join 子表 b on a.sxsdh=b.sxsdh where spcode='6921555531297' or spcode='6932010100019'
select sLSH from txslsz t1,t_xsnr t2 where t1.sxsdh=t2.sxsdh and spcode in('6921555531297','6932010100019');
select sXLSH from TXSLSZ a inner join( select sXSDH from T_XSNR where sPCODE in ('6921555531297','6932010100019') group by sXSDH having count(*)=2 )b on a.sXSDH = b.sXSDH
SELECT a.sLSH FROM txslsz a,t_xsnr b WHERE a.sxsdh=b.sxsdh AND spcode IN('6921555531297','6932010100019')
select * from TXSLSZ where exists( select a.sXSDH,count(sPCODE) from T_XSNR a inner join T_XSNR b on a.sXSDH=b.sXSDH where a.sPCODE='921555531297' and b.sPCODE='6932010100019') and a.sXSDH=TXSLSZ.sXSDH group by a.sXSDH,b.sXSDH having count(sPCODE)=2)
from TXSLSZ a
inner join(
select sXSDH
from T_XSNR
where sPCODE in ('6921555531297','6932010100019')
group by sXSDH
having count(*)=2
)b
on a.sXSDH = b.sXSDH
FROM txslsz a,t_xsnr b
WHERE a.sxsdh=b.sxsdh
AND spcode IN('6921555531297','6932010100019')
select a.sXSDH,count(sPCODE) from T_XSNR a inner join T_XSNR b on a.sXSDH=b.sXSDH
where a.sPCODE='921555531297' and b.sPCODE='6932010100019') and a.sXSDH=TXSLSZ.sXSDH
group by a.sXSDH,b.sXSDH having count(sPCODE)=2)