- paypal ipn returns invalid
- cannot manually edit applicationhost.config
- must declare the scalar variable
- classic asp and access not working on windows 2008 64bit
- asp.net page titles are blank
- sql to get totals for last six months
- white space being counted as a node
- cross page posting not working
- collection is read only exception
- PayPal sending incorrect carrier information
- paypal guest user notice
- classic asp dictionary not working
- IE8 not supporting innerHTML
- differences between jet and odbc
- sugarcrm not inserting email
- select random records from access
- button click event firing twice
- how to send an email using cdosys
- installing perl on win2003 64 bit
- asp.net page event order
- rewrite rule for subdomains only
- extra items in javascript array
- IE7 margin auto not working
- IE7 border style dotted glitch
- ByRef and ByVal in vbscript
- weather rss feed
- Classic asp crib sheet
- Firefox onsubmit image change
- limit records in access
- AccessDataSource is thick
- double margins in IE6
- extra image padding in html emails
- decimal places in linux flash player
- broken emails in outlook 2007
- double spaced IE list items
- cannot remove movieclip
articles:
sql to get totals for last six months
Straight to the point on this one
SELECT TOP 6 SUM(gross), MONTH(transactiondate), YEAR(transactiondate) FROM [orders]
GROUP BY MONTH(transactiondate), YEAR(transactiondate)
ORDER BY YEAR(transactiondate) DESC, MONTH(transactiondate) DESC
So we are grouping by month and year, then ordering most recent year first, then most recent months, this means that even if the group of months whose totals we are interested in spans more than one year, we get the months in reverse chronological order, one year at a time.
Post a comment
