I want to show records from a table having a date column from sqldatabase in dates order. How should I?
views:
53answers:
5
A:
SELECT * FROM `table_name` ORDER BY `dates_column`
optionally you can add DESC to reverse the order (newest to oldest):
SELECT * FROM `table_name` ORDER BY `dates_column` DESC
Scott Saunders
2009-10-09 20:08:36
+1
A:
you can use order by
select * from my_table t order by t.date_column
where date_column
is a column name in your table.
akf
2009-10-09 20:09:32
A:
The database engine should handle the proper sorting for a date or timestamp column using an ORDER BY clause. The only exception might be if your column is of type VARCHAR and holds a date of the form "mm/dd/yyyy". Then you've got a bit more work to do.
Tenner
2009-10-09 20:15:53