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

How to get last 3 months sales

$
0
0

Hi,

Lets say i have a query like

select sales from test where MONTH(GETDATE())>3 it gives me the past 3 months sales as we are in 6th month, but i want to have something in the where clause which can return me past 3 months sales irrespective of the month we are in, for say if we are in first month of 2014 then i must get 2013 11th month, 2013 12th month, 2014 1st month.

Can someone please help me how to change my where clause to work with this condition.

Thanks


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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