解决方案: |
sql语句说明:最后行中的RdRecord.cWhCode=‘3‘表示选择仓库编号,实际操作中请用实际仓库编号代替上述中的3:
SELECT RdRecords.ID, RdRecords.AutoID, RdRecords.cInvCode,iInvExchRate, Inventory.cInvName,Inventory.cInvStd,
Inventory.cInvM_Unit, RdRecord.dDate, RdRecord.cDepCode, Department.cDepName, RdRecord.cPersonCode, Person.cPersonName,
RdRecords.dVDate,RdRecord.cVenCode, Vendor.cVenAbbName, ltrimstrRdRecords.iQuantity,20,2 As iQuantity,
ltrimstrisnullRdRecords.iNum,0,20,2 as iNum, ltrimstrRdRecords.iUnitCost,20,2 as iUnitCost,
Inventory.iInvRCost,ltrimstrRdRecords.iPrice,20,2 as iPrice, RdRecords.cBatch,
RdRecords.cFree1,iPUnitCost,iPPrice,RdRecords.iSOutQuantity,RdRecords.iSOutNum,RdRecord.cHandler,
Code.cCode_Name AS nvCodeName,RdRecords.cFree2,RdRecords.citem_class,fitem.citem_name,RdRecords.citemcode,
‘‘,Rdrecord.cDefine1,Rdrecord.cDefine2,Rdrecord.cDefine3,Rdrecord.cDefine4 ,Rdrecord.cDefine5 ,Rdrecord.cDefine6,
Rdrecord.cDefine7 ,Rdrecord.cDefine8 ,Rdrecord.cDefine9 ,Rdrecord.cDefine10 ,Rdrecords.cDefine22 ,
Rdrecords.cDefine23 ,Rdrecords.cDefine24 ,Rdrecords.cDefine25 ,Rdrecords.cDefine26 ,Rdrecords.cDefine27
FROM code RIGHT JOIN Warehouse INNER JOIN Vendor RIGHT JOIN Person RIGHT JOIN Department RIGHT JOIN RdRecord ON Department.cDepCode= RdRecord.cDepCode ON Person.cPersonCode = RdRecord.cPersonCode INNER JOIN Inventory INNER JOIN RdRecords ON Inventory.cInvCode = RdRecords.cInvCode ON RdRecord.ID = RdRecords.ID
ON Vendor.cVenCode = RdRecord.cVenCode ON Warehouse.cWhCode = RdRecord.cWhCode ON code.ccode = RdRecord.cHandler
left join fitem on rdrecords.citem_class=fitem.citem_class
WHERE RdRecord.cVouchType=‘34‘ AND RdRecord.cWhCode=‘3‘
ORDER BY RdRecords.AutoID |