...

View Full Version : Order By



SlayerACC
01-12-2013, 05:52 PM
I current have this in my mysql statement


date_format(date, '%m/%d/%Y') as date FROM members order by date DESC

but since the new year it places all 2013 items at the end of the query.

any help would be great how I can get it to show the 2013 stuff ahead of the 2012 and etc..

Thanks


Slayer.

Fou-Lu
01-12-2013, 06:42 PM
You have aliased back to the original property name, so you are now doing string comparisons, not date comparisons. Either don't alias back to date giving it a different name, or order by members.date. Either should work.

ahamadhussain
01-17-2013, 02:45 PM
Hai...
Check this coding ...
It's worked properly...
SELECT post(datefield as date) AS date_format ORDER BY date_format DESC

Old Pedant
01-17-2013, 08:55 PM
Hai...
Check this coding ...
It's worked properly...
SELECT post(datefield as date) AS date_format ORDER BY date_format DESC

*** WRONG ANSWER ***

There is no such function as POST( ) in MySQL.

And in any case, the answer is irrelevant to the question asked.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum