SQL Order By Question

Results 1 to 3 of 3

Thread: SQL Order By Question

  1. #1
    KimberlyJ Guest

    Default SQL Order By Question

    Hi Everyone,<BR> Does anyone know of a way to ORDER BY something other than a column name? I have a column of "Day" in my DB which has all the weekdays in text form and I would like them to display in chronological order; mon, tues, wed, etc. Instead of wed,tues, thurs, etc. Any help or ideas are appreciated!<BR>Thanks,<BR>Kimberly

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL Order By Question

    Well, you could add another column (type byte) to your table and have it store the numerical representation of your days. You could display the text version and order by the numeric version. There&#039;s also a Weekday function that returns the numeric value but it takes a date (or a text representation) as its input.

  3. #3
    KimberlyJ Guest

    Default RE: SQL Order By Question

    Hi Derek,<BR>Thank you for your advice, I didn&#039;t want to add another column because it is the user that is entering all of the data. I will try the weekday function, can I use that within a SQL Statement? E.G. Select * from TableName Order By Weekday &#039;Day&#039;? All I can find if how to Order Ascending and descending. <BR>The thing is, we have a database of classes, and in the search by Name function all the times and days come up but in alphabetical order. Maybe it would be easier just to add a new column..<BR>Thanks!<BR>Kimberly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts