Page 1 of 1

Sorting Question

Posted: Tue Jan 14, 2003 12:56 pm
by fatal
Hello, i was woundering if anyone knows if you can sort a query twice. Because my news script sorts by date, but then the problem arises what if i post twice in a day. What i want to do is to first sort by date then by time. Is that possible within one query? Thank you.

Posted: Tue Jan 14, 2003 1:09 pm
by Elmseeker
why not just put a unix time stamp into the DB ina field called...whatever you want I guess let's call it sortme for his example and then just ORDER by sortme DESC LIMIT 0,7
to show the last 7 entries in reverse order in which they were posted...

Sorting Question

Posted: Tue Jan 14, 2003 9:53 pm
by fractalvibes
Also bear in mind that you can sort on a number of fields....
If your table looked like:

ArticleID - int autonumber
ArticelText - varchar 255
PostDate - Date
PostTime - TimeStamp
......etc you could:

SELECT ArticleText
, ArticleID
.......etc
WHERE.....etc
ORDER By PostDate, PostTime


would do it also if you kept the date and time seperate...

Phil J.

Posted: Wed Jan 15, 2003 11:38 am
by fatal
Thank you guys for all you ideas, and help!