I'm trying to create a BBS using PHP and SQL, and I want to make it so the topic with the most current post is on top of the topic list. what is a easy way to check if one date and time is more current than another?
+1
A:
From Sql using ORDER BY DESC
SELECT *
FROM MyTable
ORDER BY DateVal DESC
Other than that, please provide so table schema for us to work with, or what you have tried (in code) so we can have a look...
astander
2010-03-11 21:10:59
+1
A:
if their datatype is datetime then a simple greater than ( >
) will do
But you do not have to compare between dates, just sort them according to date with descending direction ..
ORDER BY [datefield] DESC
Gaby
2010-03-11 21:12:06
A:
Mike Cialowicz
2010-03-11 21:12:54