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

Re: Query Yearly Revenue by month

$
0
0

SELECT year(T1.Docdate) as [year] This is my attempt at starting this.. I only did till April ISNULL([Jan],0) as [Jan], ISNULL([Feb],0) as [Feb], ISNULL([Mar],0) as [Mar], ISNULL([Apr],0) as [Apr] FROM (Year, (T1.Doctotal) AS [BAL],year(T1.Docdate) as [year]  FROM dbo.OCRD T0           LEFT JOIN dbo.OINV T1 ON T1.CardCode = T0.CardCode  Where  T0.[CardType] ='C'           UNION           SELECT Year, -(T1.Doctotal)  AS [BAL],year(T1.Docdate) as [year]  FROM dbo.OCRD T0           LEFT JOIN dbo.ORIN T1 ON T1.CardCode = T0.CardCode  Where  T0.[CardType] ='C'  ) S           PIVOT  (SUM(S.[BAL]) FOR [year] IN         ([Jan],[Feb],[March],[April])) P Order By Year


Viewing all articles
Browse latest Browse all 3585

Trending Articles



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