Calilo
04-27-2006, 06:32 PM
Hi, a simple question
im using php and mysql, but i would like from the sql statement to get the results of a query order by a column and then reorder by another column that is:
i want to select the last four entries accoding to the date.
SELECT * FROM table ORDER BY Date DESC LIMIT 4
but I also want to order those 4 entries i got, according to their values at the order column like this
SELECT * FROM table ORDER BY ordercol ASC LIMIT 4
how can i put this two together?
i thougt of
SELECT * FROM table ORDER BY Date DESC, ordercol ASC LIMIT 4
but it gets the last four entries and then if two entries have the same date it orders them according to the ordercol, how can it do it?
hope i explained myself
thank
Calilo
im using php and mysql, but i would like from the sql statement to get the results of a query order by a column and then reorder by another column that is:
i want to select the last four entries accoding to the date.
SELECT * FROM table ORDER BY Date DESC LIMIT 4
but I also want to order those 4 entries i got, according to their values at the order column like this
SELECT * FROM table ORDER BY ordercol ASC LIMIT 4
how can i put this two together?
i thougt of
SELECT * FROM table ORDER BY Date DESC, ordercol ASC LIMIT 4
but it gets the last four entries and then if two entries have the same date it orders them according to the ordercol, how can it do it?
hope i explained myself
thank
Calilo