Hello All
I have written a query to check all open purchase order for two suppliers by their supplier code
It works, but I have a problem and I can't fix
When I run it. It checks for all open rows on the purchase order and displays it as open PO's
My problem is, If there are 10 rows open in a single PO eg: 344160 with
4 rows with delivery date as 05/02/15
5 rows with delivery date as 20/02/15
1 row with delivery date as 15/03/2015
I need it to add the row total for those dates as display a total due that date
Should display result in one row and not as 4; 5 and 1 row with the same PO no
PO No | Delivery Date | Total |
---|---|---|
344160 | All rows that have a delivery date as 05/02/15 | All rows that have a delivery date as 05/02/15 |
344160 | All rows that have a delivery date as 20/02/15 | All rows that have a delivery date as 20/02/15 |
344160 | All rows that have a delivery date as 15/03/15 | All rows that have a delivery date as 15/03/15 |
The query I have written is below
SELECT T0.[DocNum}, T0.[CardCode], T0.[CardName], T0.[DocDate], T1.[ShipDate], T1.[TotalSumSy], T0.[DocRate], T0.[U_ShipType] FROM OPOR T0 INNER JOIN POR1 ON T0.DocEntry = T1.DocEntry WHERE T0.[CardCode] between 'S1070' and 'S1075' and T1.[LineStatus] = 'O' GROUP BY T0.[DocNum], T0.[CardCode], T0.[CardName], T0.[DocDate], T1.[ShipDate], T1.[TotalSumSy], T0.[DocRate], T0.[U_ShipType] ORDER BY T1.[ShipDate]
Thanks and Regards
Rahul