这个SQL怎么写啊? 急~!
select distinct autoId,define2,inventCode,suppCode,printDate,
sum(cast(inventNum as float))as num,
case status when inventbarcode in(select inverntbarcode from t_deliveryVouchs) then '已收货待验货 '
when inventbarcode not in(select inverntbarcode from t_deliveryVouchs) then '未收货 ' end
from t_barcode
group by autoId,define2,inventCode,suppCode,printDate,status
------解决方案----------------------try
select distinct autoId,define2,inventCode,suppCode,printDate,
sum(cast(inventNum as float))as num,
case status when inventbarcode in(select inverntbarcode from t_deliveryVouchs) then '已收货待验货 ' else '未收货 ' end
from t_barcode
group by autoId,define2,inventCode,suppCode,printDate,status,inventbarcode
------解决方案-------------------- select aa.*,case when inventbarcode in(select inverntbarcode from t_deliveryVouchs) then '已收货待验货 '
when inventbarcode not in(select inverntbarcode from t_deliveryVouchs) then '未收货 ' end xx
from
(select distinct autoId,define2,inventCode,suppCode,printDate,status,
sum(cast(inventNum as float))as num
from t_barcode
group by autoId,define2,inventCode,suppCode,printDate,status
)aa