Saturday, 15 June 2013

sorting - sql query for retrieving default or sorted values -



sorting - sql query for retrieving default or sorted values -

im trying figure out how write sql query this:

i have database contains column x. x has datetime values if set function otherwise has default value looks 0001-01-01.00.00.00.000000

what interested in doing writing sql retrieve rows of x sorted latest datetime values.

i thought reply

select * some_table st st.dbname = "blah" order_by st.x desc

but thinking happens default values? how impact sorting

any ideas if way go?

ordering date desc work fine. why not create column nullable don't need default? sounds want latest single record may want consider using select top 1 * blah order date desc

sql sorting syntax order

No comments:

Post a Comment