on 09-23-2018 5:05 AM
Dear all.
I need query for Top 7 customer, with 2 condition. First, include credit memo. second, only for cust. With nothing aging of A/R payment >= 60 days.
I have query for first condition, but i need add for 2 condition. My 1 condition query:
SELECT TOP 5 T0.ShortName 'Customer', Max(T2.CardName) 'Customer Name', SUM(ISNULL(T0.Debit,0) - ISNULL(T0.Credit,0)) as "Amount(LC)" FROM dbo.JDT1 T0 INNER JOIN dbo.OJDT T1 ON T1.TransID = T0.TransID and T0.TransType IN (13,14) INNER JOIN dbo.OCRD T2 ON T2.CardCode = T0.ShortName WHERE t1.RefDate >= [%0\] and t1.RefDate <= [%1\] GROUP BY T0.ShortName Order by SUM(ISNULL(T0.Debit,0) - ISNULL(T0.Credit,0)) DESC
Please for your advice thanks
*For nagarajan, pardon me to tag you because this important question
-Jurig Jrian
Regrads
Hi,
Explain your 2 condition with an example.
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 |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.