www.webdeveloper.com
Results 1 to 4 of 4

Thread: sort by time

  1. #1
    Join Date
    Dec 2005
    Posts
    203

    sort by time

    Quick question for the pros.

    I have a column in MS sql called time with values like:

    9:00 am
    1:15 pm
    3:00 pm
    11:00 am

    and so forth. No row having more then one time in this column. So when I recall this data I would like to sort by that column. Although it doesn't seem as though sql can apply a value to this data for sorting purposes. I'd imagine this is because of the mixed data types.

    So what's the work around for this?

    This is for a weekly schedule written in php.

    Thanks for your time.

  2. #2
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    are you storing it as a string?? i bet you're storing it as a string! if so, stop storing it as a string and it'll work!
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

  3. #3
    Join Date
    Feb 2003
    Posts
    2,745
    agreed. of course mssql 2k doesn't have a time data type, so you'll want to make it a smalldatetime

  4. #4
    Join Date
    Dec 2005
    Posts
    203
    Quote Originally Posted by russell
    agreed. of course mssql 2k doesn't have a time data type, so you'll want to make it a smalldatetime
    Oh hell, I bet you are right. Thanks (once) again, your all are my heros.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles