Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)

  • RE: Sorting Months By Number (SQL Spackle)

    Thanks for following up and testing the different solutions Jeff - makes for interesting reading. The personal lesson for me from this is "test your code before posting". That way...

  • RE: Sorting Months By Number (SQL Spackle)

    Harveysburger (12/10/2010)


    SELECT [Month] = DATENAME(mm, DATEADD(mm, MONTH(SomeDateTime), 0)), Amount = SUM(SomeAmount)

    FROM #MyHead

    WHERE SomeDateTime...

  • RE: Sorting Months By Number (SQL Spackle)

    Geoff A (11/15/2010)


    N.North (11/15/2010)


    You could go for casting the month numbers to names in the select rather than in the ORDER BY clause, as it allows you to use MONTH...

  • RE: Sorting Months By Number (SQL Spackle)

    Geoff A (11/15/2010)


    Kristian Ask (11/15/2010)


    hugo-939487 (11/15/2010)


    Another variaton, using the MONTH function:

    SELECT [Month] = DATENAME(mm,SomeDateTime),

    Amount = SUM(SomeAmount)

    FROM #MyHead

    ...

  • RE: Sorting Months By Number (SQL Spackle)

    You could go for casting the month numbers to names in the select rather than in the ORDER BY clause, as it allows you to use MONTH in most places,...

Viewing 5 posts - 1 through 5 (of 5 total)