vendredi 6 février 2015

Order by where conditions



SELECT * FROM table
WHERE
key REGEXP 'some long regular expression'
OR key REGEXP 'some other long regular expression'

ORDER BY
key REGEXP 'some long regular expression' DESC,
key REGEXP 'some other long regular expression' DESC


Is there a cleaner way to get the same result as above, without repeating the where conditions in order by?





Aucun commentaire:

Enregistrer un commentaire