Solved

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

Posted on 2010-11-17
2
397 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

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…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

774 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