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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sorting the days

Status
Not open for further replies.

krzysrb

Technical User
Jun 23, 2003
30
CA
hey ppls

i have posted a similar thing in DB section, but this concerns more sql so here is my problem

SELECT [First Name], [Last Name], Day, [Start Time], [End Time]
FROM times
ORDER BY Day

i run the above and i was originally (and foolishly to be honest) hoping i was going to get a list sorted mon, tue, ... sun, but no, i got the real asc ordering. I am running this query as a part of my VB program, and i would like to know if there is a way to go around this and get it sorted mon...sun. my day field, to make things worse, i have stored as a text in the DB.

Any help is greatly appreciated ppls,

thanks
vlada
 
You could pull the day out of one of the dates.

SELECT [First Name], [Last Name], weekday([Start Time]) as myday, [Start Time], [End Time]
FROM times
ORDER BY weekday([Start Time])
 
But that will oder the result Sun through Sat, not Non through Sun.

On the other hand, you would need a function to provide the off-set to get the exact sort. Also note that the process will sort ALL records strictly by the "day".





MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
hey guys

thanks for your help, but i followed to another suggestion from another helpfull guy here, and he suggested SWITCH statement in the ORDER BY line, and it runs smoothly. the credit goes to CCLINT, but thank you for your efforts.

vlada
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top