Problem sorting by date

Results 1 to 2 of 2

Thread: Problem sorting by date

  1. #1
    Join Date
    Dec 1969

    Default Problem sorting by date

    Good afternoon,<BR><BR>I believe this is not a database issue but more of a ASP issue.<BR><BR>I am sorting records using the below command:<BR>SQLtemp="select * from ads where AdType=&#039;Cars for Sale&#039; ORDER BY AdDate DESC"<BR><BR>This should list all records in descending order based on the contents of the AdDate column. AdDate is of type varchar (Maybe the problem?)<BR><BR>I have dates in the AdDate column from August to October. Dates look like 8/5/2001 or 10/22/2001 etc. The date represents the date that the record was added to the database. I would like to sort the records by descending order - newest first, oldest at the bottom. But I see that records in August are listing above the records in October. It appears that SQL is seeing 8 as a higher number than 10. <BR><BR>You can see the output of the querry here:<BR> which illustrates the problem.<BR><BR>Any suggestions? If this is more of a database problem, please let me know and I will post this in the DB forum.<BR><BR>Rob<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Problem sorting by date

    make it of type date. :) it will work beautifully for you then.<BR><BR>ps. don&#039;t be afraid to try things. You had the idea that being varchar wasn&#039;t good, you should have tried it out yourself. :)

Posting Permissions

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