dimanche 19 juillet 2015

SQLite: ...EXCEPT ... ORDER BY RANDOM()

This query:

SELECT colour FROM ColourView EXCEPT SELECT colour FROM SkinColourExceptionsView WHERE race = 'Human' ORDER BY RANDOM() LIMIT 1

Produces the following exception: 1st ORDER BY term does not match any column in the result set

However, changing ORDER BY RANDOM() to ORDER BY colour is able to produce results (sorted alphabetically by colour rather than randomly). The following suggests that ORDER BY RANDOM() LIMIT 1 should work: Select random row from an sqlite table. Can someone explain why my query doesn't work?

Aucun commentaire:

Enregistrer un commentaire