translate dd-mm-yy to unixtime stamp, then order by that unixtime stamp. you can do it within one SQL statement.
regards, anru On Oct 8, 2:04 pm, "Karl" <[EMAIL PROTECTED]> wrote: > Gidday gurus... > > Yes, technically this is a MySQL problem, but I figure this is my closest > source of an answer, so I beg your indulgence and assistance... > > While overhauling an old site, I noticed that they had been sorting the > results of an SQL query by $PostedDate, which was in the format of "VarChar" > as DD-MM-YY... > > However, the results are coming back sorted ONLY by DD... so what we are > getting is... > 1 : 1-04-06 > 2 : 11-06-03 > 3 : 4-06-08 > 4 : 5-06-07 > > What is ACTUALLY needed is... > 1 : 4-06-08 > 2 : 5-06-07 > 3 : 1-04-06 > 4 : 11-06-03 > > Without going through an adjusting or changing any of the data (well over > 300,000 records!)... can anyone suggest a better way of getting MySQL to sort > these properly? We need display-by-date, most-recent-first... > > Yes, I could filter it all through a PHP module to tidy it up, but this > will add massive overhead to the operations... if it can be sorted in such a > way as to shove the workload to the SQL server, would be best methinks... > > All help, in easy-to-grasp syntax, gratefully appreciated... > > Cheers... > --- > Karl > Senior Account Managerwww.KIWIreviews.co.nz... Where Your Views Count > Please consider the environment before printing this email. > > Supporting Palmerston North's Santa... see our Community Gold Project > page:http://www.KIWIreviews.co.nz/santa- To be seen on TVNZ's 'Mucking In' > show! --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [EMAIL PROTECTED] -~----------~----~----~----~------~----~------~--~---
