日期:2014-05-17 浏览次数:20489 次
select BILLID, qty, exeqty from tab a inner join tab b on a.BILLID=b.BILLID where a.exeqty>b.qty --你需要的结果应该是 /* billid qty exeqty 1001 600 700 1001 350 350 1001 700 750 */
------解决方案--------------------
select * from tb a where a.exeqty>=a.qty and not exist(select 1 from tb b where a.billid=b=billid and b.exeqty<b.qty )