Solved

How do I make this query order by month: January, February, March....?

Posted on 2010-11-17
2
396 Views
Last Modified: 2012-05-10
With the current query it orders the months alphabeticaly. How do I make it order correctly?
SELECT



  DATENAME(mm,FilteredNew_application.new_effectivestartdate) as Month

  ,sum(FilteredNew_application.new_gp) as GP

  ,sum(FilteredNew_application.new_approvalamount) as Approval

  ,sum(FilteredNew_application.new_equiptmentcost) as Revenue

  

FROM

  FilteredNew_application

WHERE

  FilteredNew_application.new_primaryvendoridname LIKE N'Dell%'

  AND FilteredNew_application.new_applicationstatusname = N'Vendors Paid'

AND FilteredNew_application.new_effectivestartdate >= N'02/01/2010 00:00:00'



Group by DATENAME(mm,FilteredNew_application.new_effectivestartdate)

Order by DATENAME(mm,FilteredNew_application.new_effectivestartdate)

Open in new window

0
Comment
Question by:varesources
2 Comments
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 500 total points
ID: 34158388
Change the group by and order by. This won't affect your grouping.

Group by DateName(mm, ..date..), Month(..date..)
Order by Month(..date..)
0
 
LVL 1

Author Comment

by:varesources
ID: 34158406
Thank you!
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

29 Experts available now in Live!

Get 1:1 Help Now