Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Order by problem.......how to Ascending order by date from the following query

$
0
0

hi

i have following query to show the monthly sales after summing up monthly sales total but i have facing a problem this query is not properly perform order by clause according to the months like jan,feb,mar etc... please tell me where i made mistake

SELECT     CashName AS AccountName, LEFT(DATENAME(month, CashDate), 3) + ' - ' + DATENAME(year, CashDate) AS Months, SUM(Total) AS NetSales
FROM         dbo.CashSales
GROUP BY LEFT(DATENAME(month, CashDate), 3) + ' - ' + DATENAME(year, CashDate), CashName



Viewing all articles
Browse latest Browse all 23857

Trending Articles



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