[thelist] select

rudy r937 at interlog.com
Tue Jan 9 19:48:26 CST 2001

> is there to get the results of a sql query to sort
> by actual date instead of numbered date?
> [snip]
> any suggestions?  btw, i'm using asp if that makes
> a difference...  thanks!

hi andrew

sounds like you're sorting a character field

which database are you using, sql/server or ms access?  how did you define
the date field?

the appropriate sql is

    select yourDate, yourOtherfields
        from yourTable
     order by yourDate

which is probably what you're doing already, so the problem has to be in
the datatype of the column

and no, the fact that you're using asp shouldn't matter, because
don't ever sort query results in the scripting language, let the database
return the results in the order you want

if the data is being stored in the database as a character string, you
might want to change that so that it converts the dates to an actual date
field on input

you /could/ convert it on output, i.e. in the select statement so that it
will sort properly, but this is a much less preferred approach


More information about the thelist mailing list