Solved

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

Posted on 2010-11-17
2
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

756 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