This is retarded - MS SQL question

AsSiMiLaTeD
AsSiMiLaTeD Posts: 11,725
edited March 2008 in The Clubhouse
There's no way this should be this difficult. I have a datetime field, and all I want returned is the month and year for some grouping I'm doing. I can get it to the mm/dd/yyyy format using the CONVERT function, but I don't see a code for the mm/yyyy format...

Any ideas?

Comments

  • AsSiMiLaTeD
    AsSiMiLaTeD Posts: 11,725
    edited March 2008
    OK, got it figured out - that is so f#$%ing retarded to have to do it this way:
    SELECT DateAdd(Month, DateDiff(Month, 0, Call_End_DateTime), 0) AS [Date],
    COUNT(PS_ID) AS totalpermonth
    FROM ivr..tbl_BA
    Where (PS_ID) IS NOT NULL AND (PS_ID) <> 0
    GROUP BY DateAdd(Month, DateDiff(Month, 0, Call_End_DateTime), 0)
    ORDER BY [Date]