Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL order by month 1

Status
Not open for further replies.

mars19301

MIS
May 31, 2001
69
US
Would somebody please tell me the code (I assume the order by line) to sort a mmddyyyy field by month (birthdays). Thank you in advance.

Jim
 
Jim:

I must be missing something. Isn't

"I assume the order by line) to sort a mmddyyyy field by month "

mmyddyyyy a date field defined in the database? Isn't

select date_column from some_table order by date_column

order month in ascending order?


Like i said: I'm probably missing something.


Regards,


Ed
 
For a birthday list, I need all those for June (regardless of year of birth) followed by all for July etc.. I found an
old Informix scrip in an ACE report. If anybody wants it, I'll post it.

Thanks for your consideration.

 
Jim:

If you are doing something like this (coldate is a date)

select month(coldate) from table_eds
where month(coldate) = 6 or month(coldate) = 7 order by 1

this works fine. Just a warning that this is a full table scan regardless if an index exists on coldate or not.

Regards,


Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top