Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9069

How can I group by Card code

$
0
0

This report gives me two lines when the card name is different due to some invoices having a different name . I would like to group by the Card Code which stays the same.  Any assistance would be greatly appreciated. I have an idea it has something to do with On t.CardCode = pt.CardCode but need help. SELECT * FROM ( SELECT year(T0.DocDate) as [Year],T0.CardCode, T0.CardName, SUM(DATEDIFF(DAY,T0.DocDate,T1.DocDate))/COUNT(T0.Docnum) AS 'AVG DEBTOR DAYS' FROM DBo.OINV T0 Left JOIN DBO.ORCT T1 ON T0.ReceiptNum = T1.DocEntry WHERE T0.DocStatus ='C' GROUP BY T0. DocDate,T0.CardCode, T0.CardName ) S. ON t.CardCode = ts.CardCode Having SUM(DATEDIFF(DAY,T0.DocDate,T1.DocDate)) > 0 ) as s      PIVOT  (AVG( s. [AVG DEBTOR DAYS])        FOR S. [Year]  IN        ([2011],[2012],[2013],[2014],[2015],[2016],[2017],[2018],[2019]) ) as P


Viewing all articles
Browse latest Browse all 9069

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>