SELECT DISTINCT(AB_ID),AB_NUMBER,AB_TO_STATION,AB_CREATE_DATE, (SELECT COUNT(*) FROM dbo.SBD_ASSEMBLYBILL_WAYBILL WHERE AW_AB_ID=AB_ID) AS WTOTAL, (SELECT SUM(WG_AMOUNT) FROM dbo.SBD_WAYBILL_GOODS WHERE WG_SW_ID IN (SELECT AW_SW_ID FROM dbo.SBD_ASSEMBLYBILL_WAYBILL WHERE AW_AB_ID=AB_ID)) AS UTOTAL FROM dbo.SBD_ASSEMBLY_BILL a LEFT JOIN dbo.SBD_ASSEMBLYBILL_WAYBILL aw ON a.AB_ID=aw.AW_AB_ID WHERE a.AB_SC_ID=61 AND a.AB_IS_ARRIVE=0
如果本文引用了你的文章而未注明,请及时联系我。