日期:2014-05-18 浏览次数:20674 次
select distinct invoice_no from shipment A where exists(select 1 from ship where invoice_no =A.invoice_no and supplier_no=A.supplier_no)
------解决方案--------------------
select * from
(
select invoice_no,supplier_no,count(1) as a
from shipment group by invoice_no,supplier_no
) a left join
(
select invoice_no,supplier_no,count(1) as b
from ship group by invoice_no,supplier_no
) b
on a.invoice_no=b.invoice_no and a.supplier_no=b.supplier_no and a.a<>b.b
------解决方案--------------------
select distinct invoice_no
from shipment A
where not exists(select 1 from ship where invoice_no =A.invoice_no and supplier_no=A.supplier_no)