I have to sum invoice total from a table in sql server 2008 based of two given dates let suppose 01/01/2012 to 07/31/2013 in terms of each months in given dates.
Like this..
Jan 12 30000
Feb 12 40000
July 13 45000
Your help is highly appreciated.
SELECT DATEPART(MONTH, invoiceDate), DATEPART(YEAR, invoiceDate), COUNT(1)
FROM table1
where invoiceDate between '1/1/2012' and '7/31/2013'
GROUP BY DATEPART(MONTH, invoiceDate), DATEPART(YEAR, invoiceDate)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments