I hope someone can help me on this.
I have looked all over the forumn for assistance before posting.
I am looking for a SQL Query that produces the same results that the 'Customer Receivables Aging' report produces.
So far I have this but when ever I attemt to seubtract Credits the totals are off.
SELECT "OCRD"."U_ASINumber", "OCRG"."GroupName", "OCRD"."U_Channel", "OINV"."DocTotal", "OINV"."DocDueDate", "OINV"."DocStatus", "OCRD"."CardName", "OCRD"."CardCode"
FROM ("DRI_DUCK"."dbo"."OINV" "OINV" INNER JOIN "DRI_DUCK"."dbo"."OCRD" "OCRD" ON "OINV"."CardCode"="OCRD"."CardCode") INNER JOIN "DRI_DUCK"."dbo"."OCRG" "OCRG" ON "OCRD"."GroupCode"="OCRG"."GroupCode"
WHERE "OCRG"."GroupName"=N'Corporate' AND "OCRD"."U_Channel"=N'2'
ORDER BY "OCRD"."CardCode", "OCRD"."U_ASINumber"
Ant help would be great.
Thanks,
Craig