求一个sql2000语句
现有pdkcb表,有两个盘点号,pd_hao='p130324001' pd_hao='p130324002'
求查询出p130324001,p130324002这两个盘点号中bian_hao,pi_hao相同的品种 sql语句
[解决办法]
select * from
(select * from pdkcb where pd_hao='p130324001') t1
inner join
(select * from pdkcb where pd_hao='p130324002') t2
on t1.bian_hao = t2.bian_hao and t1.pi_hao = t2.pihao
select * from (
select * from pdkcb where pd_hao in('p130324001','p130324002'))
a,
select * from pdkcb where pd_hao in('p130324001','p130324002')
b
where a.bian_hao = b.bian_hao
and a.pi_hao = b.pi_hao
select *
from pdkcb as a
where a.pd_hao in('p130324001','p130324002')
and exists(select 1 from pdkcb where bian_hao=a.bian_hao and pi_hao=a.pi_hao and pd_hao <>b.pd_hao and pd_hao in('p130324001','p130324002'))