I am trying to break down a date field into quarter and group by years. I can order by dates but I am having no luck find a howto on quarters. Any hint tips out there?
many thanks
Mike
Thanks!
SELECT TYPE,vendor,discontinueddate, datepart(quarter, GETDATE()) AS 'Quarter'from EOLWHERE (DISCONTINUEDDATE >= '01/01/2005')Order by discontinueddate
works and returns the Current quarter but how do I change the GETDATE to cover all years 2005 and above?
SELECT TYPE,vendor,discontinueddate, datepart(quarter,[discontinueddate]) AS 'Quarter'from EOL WHERE (DISCONTINUEDDATE >= '01/01/2005')Order by Discontinueddate
Works!!!
what if I need the quarters always 24 months from today everyday?
I tried using the DateAdd("m",24,Now());
But no luck
Hints??
use getdate() instead of now(). and no need to quote the mm
select DateAdd(mm,24,getdate())