Solved

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

Posted on 2010-11-17
2
395 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
Comment Utility
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
Comment Utility
Thank you!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A recent questions about how to add SSRS named instances, couldn't find any that talks about SQL server 2008, anyway I decided to help by creating some screen shots. The installation is straightforward, you just pop the SQL server 2008 installati…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

9 Experts available now in Live!

Get 1:1 Help Now