on 12-18-2013 10:40 PM
Hello All
I need two queries and I am getting an error with it.
I have done the below, but I am getting an error
Can someone please have a look and advise where I am going wrong?
SELECT T0.[DueDate],
T0.[DocNum],
T0.[U_CustName],
T0.[PlannedQty],
T2.[Dscription],
T1.[PlannedQty],
T2.[LineTotal]
FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry, RDR1 T2
WHERE T0.[DueDate] = >[%0] T0.[DueDate] <[%1]
ORDER BY T0.[DocNum]
SELECT T0.[DueDate],
T0.[DocNum],
T0.[U_CustName],
T0.[PlannedQty],
T2.[Dscription],
T1.[PlannedQty],
T2.[LineTotal]
FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry, RDR1 T2
WHERE T0.[DueDate] = >[%0] T0.[DueDate] <[%1] T1.[ItemCode] IS NOT NULL[%2]
ORDER BY T0.[DocNum]
Thanks and regards
Rahul
Hi Rahul,
Try this:
SELECT T0.[DueDate], T0.[DocNum], T0.[U_CustName], T0.[PlannedQty], T3.[Dscription], T1.[PlannedQty], T3.[LineTotal] FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry left join ORDR T2 on T2.[DocNum] = T0.[OriginNum] left JOIN RDR1 T3 ON T2.DocEntry = T3.DocEntry and T3.ItemCode=T0.ItemCode WHERE T0.[DueDate] >= [%0] and T0.[DueDate] <= [%1] ORDER BY T0.[DocNum]
Make sure you enter a longer duration at first.
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this query:
SELECT T0.[DueDate], T0.[DocNum], T0.[PlannedQty], T3.[Dscription], sum(T1.[PlannedQty]), T3.[LineTotal] FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry left join ORDR T2 on T2.[DocNum] = T0.[OriginNum] left JOIN RDR1 T3 ON T2.DocEntry = T3.DocEntry and T3.ItemCode=T0.ItemCode WHERE T0.[DueDate] >= [%0] and T0.[DueDate] <= [%1] group by T0.[DueDate], T0.[DocNum], T0.[PlannedQty], T3.[Dscription],T3.[LineTotal] ORDER BY T0.[DocNum]
Thanks & Regards,
Nagarajan
Try:
SELECT T0.[DueDate], T0.[DocNum], T0.[U_CustName], T0.[PlannedQty], T3.[Dscription], T3.[LineTotal]
FROM OWOR T0
left join ORDR T2 on T2.[DocNum] = T0.[OriginNum] left JOIN RDR1 T3 ON T2.DocEntry = T3.DocEntry and T3.ItemCode=T0.ItemCode WHERE T0.[DueDate] >= [%0] and T0.[DueDate] <= [%1] ORDER BY T0.[DocNum]
Hi Nagarajan
It displays the correct results if the production orders have been completed
But for production orders that haven't been completed
It is showing multiple results and incorrect row totals
Is there a way if displays the correct row total even if the production order isnt completed?
Thanks and regards
Rahul
Hi Gordon
It displays the correct results if the production orders have been completed
But for production orders that haven't been completed
It is showing multiple results and incorrect row totals
Is there a way if displays the correct row total even if the production order isnt completed?
Thanks and regards
Rahul
Hi Rahul Fernandez,
Try to put production status in selection criteria in query...
Hi Rahul
Find the Query Below
SELECT T0.[DueDate],T0.[DocNum],T0.[U_CustName],T0.[PlannedQty],T3.[Dscription],
T1.[PlannedQty],T3.[LineTotal]
FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry,
ORDR T2 INNER JOIN RDR1 T3 ON T2.DocEntry = T3.DocEntry
WHERE T0.[DueDate] >='[%0]' AND T0.[DueDate]<='[%1]'
AND T0.OriginNum = T2.DocNum
ORDER BY T0.[DocNum]
Regards
Jenny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1. There is no proper link between RDR1 and OWOR tables. If you run without correct join, system performance will be affected.
2. Try this query:
SELECT T0.[DueDate], T0.[DocNum], T0.[U_CustName], T0.[PlannedQty], T3.[Dscription], T1.[PlannedQty], T3.[LineTotal] FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry left join ORDR T2 on T2.[DocNum] = T0.[OriginNum] and T2.[CardCode] = T0.[CardCode] INNER JOIN RDR1 T3 ON T2.DocEntry = T3.DocEntry WHERE T0.[DueDate] >= [%0] and T0.[DueDate] < [%1] ORDER BY T0.[DocNum]
3. As per forum rule, one question per thread allowed. For second query,please post as new discussion.
Thanks & Regards,
Nagarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
7 | |
7 | |
6 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.