Connect your existing Source Control system to SSMS in 5 minutes
Getting started with SSIS - Part 1: Introduction to SSIS
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.
Loading

Ask in the public forum

Ask your questions in a public forum

My Blog Posts

SQL Server Monitoring
  • order by problem

    SELECT COUNT(COURSEID) AS [COUNT], UPPER(DATENAME(MONTH,CONVERT(VARCHAR(50),DATEADD  (MM, 0, STAMP),106)))
    AS [MONTH]
    ,DATENAME(YY,STAMP) AS [MONTH] 
    FROM SESSIONSTATS
    WHERE STAMP BETWEEN STAMP AND GETDATE() and datediff(mm,STAMP,GETDATE())<=4
    GROUP BY DATENAME(MONTH,CONVERT(VARCHAR(50),DATEADD  (MM, 0, STAMP),106)),DATENAME(YY,STAMP)
    ORDER BY DATENAME(MONTH,CONVERT(VARCHAR(50),DATEADD  (MM, 0, STAMP),106)) DESC

    output of above query like this :

    20356    OCTOBER    2009
    18902    NOVEMBER    2009
    11898    JANUARY    2010
    20994    DECEMBER    2009

     

    but I want to order like this

    11898    JANUARY    2010

    20994    DECEMBER    2009

    18902    NOVEMBER    2009

    20356    OCTOBER    2009

     

    how can i achive this.?

    dhandapani
    1186 · 0% · 9

2  Replies  

Subscribe to Notifications

Your Reply


Sign Up or Login to post an answer.

Managed Windows Shared Hosting by OrcsWeb

Copyright © Beyondrelational.com