Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- *
- FROM (
- SELECT
- po_m.cPOID,
- po_d.ID,
- po_d.cInvCode,
- po_d.cFree1,
- po_d.iQuantity po_qty,
- count(rd01_m.cCode) over(partition by iPOsID) count,
- rd01_d.iQuantity,
- sum(rd01_d.iQuantity) over(partition by iPOsID) total_qty,
- rd01_m.dVeriDate,
- rd01_m.cCode
- FROM PO_Podetails po_d
- LEFT JOIN PO_Pomain po_m
- ON po_d.POID = po_m.POID
- LEFT JOIN rdrecords01 rd01_d
- ON rd01_d.iPOsID = po_d.ID
- LEFT JOIN RdRecord01 rd01_m
- ON rd01_d.ID = rd01_m.ID
- ) tmp
- WHERE po_qty < total_qty
- ORDER BY cPOID, cInvCode, dVeriDate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement