Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7528611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:25:45+00:00 2026-05-30T04:25:45+00:00

I have a procedure that return daily report between a time example (CreateDate BETWEEN

  • 0

I have a procedure that return daily report between a time example (CreateDate BETWEEN ‘2012/1/21’ AND ‘2012/2/19’)

I want this result

1/21
1/22
1/23
.
2/1
.
.

But the output is sorted automatically based on the day!!As follows:

2/1
2/2
.
2/15
1/21
1/22
1/23
.
.

I cant using order by (createdate) because I have this select:

SELECT     COUNT(UserId) AS c, DAY(CreateDate) AS d
FROM       dbo.aspnet_Membership
WHERE     (CreateDate BETWEEN '2012/1/21' AND '2012/2/19')
GROUP BY DAY(CreateDate)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:25:46+00:00Added an answer on May 30, 2026 at 4:25 am

    If you want to sort by month and day, then you need month of course.

    And you always need an ORDER BY to guarantee the result order.

    SELECT     COUNT(UserId) AS c, MONTH(CreateDate) AS m, DAY(CreateDate) AS d
    FROM       dbo.aspnet_Membership
    WHERE     (CreateDate BETWEEN '2012/1/21' AND '2012/2/19')
    GROUP BY  MONTH(CreateDate) AS m, DAY(CreateDate) AS d
    ORDER BY  MONTH(CreateDate) AS m, DAY(CreateDate) AS d
    

    In this case, the order you got was coincidence because of the GROUP BY (which implies an ORDER BY in MySQL, but not other RDBMS)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stored procedure that returns a result with 250!!! columns. But I
I have a MYSQL stored procedure SP1() that returns a result set. I want
I have a stored procedure that will return a list of ids. I want
I have a stored procedure that return a varbinary(max) type data. I want to
Sorry for this simple question . I have a Stored Procedure that return an
I have a stored procedure that needs to return something from one of two
I have a stored Procedure that do some operation and return 1 or 0
Here I have a stored procedure that inserts a row but how do you
I have a stored procedure that returns a result set (4 columns x n
I have a stored procedure that returns multiple resultsets, it looks something like this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.