MS SQL - Help building a Query
Posted on 2008-10-03
I have the following query...
SELECT Year(TransDate) AS TransDateYear, Month(TransDate) AS TransDateMonth, SUM(Amount)
WHERE TransDate BETWEEN '1-1-2006' AND '1-1-2009'
AND Category IN ('Gasoline')
GROUP BY Year(TransDate), Month(TransDate)
ORDER BY Year(TransDate), Month(TransDate)
I need the date to be returned in 1 column in the format of " Jan'07 " instead of two different columns. Currently TransDateYear is returned as "2007" and TransDateMonth is returned as "1"