tags:

views:

84

answers:

2

By that I mean... if I have a column named "special" and rows that are marked 1 in that column would appear at the top of the results, even if the ORDER BY clause would list them elsewhere. For example, I display items by date, in descending order. Items that are marked special=1 would appear at the top of the results, regardless of their timestamp.

How can I achieve this?

+2  A: 

ORDER BY 'special' first (descending) and then by your other criteria.

Mitch Wheat
+6  A: 

You can put multiple columns in an ORDER BY clause

SELECT * from your_table ORDER BY special DESC, date_col DESC
Richard Levasseur