这个查询:
SELECT colour FROM ColourView EXCEPT SELECT colour FROM SkinColourExceptionsView WHERE race = 'Human' ORDER BY RANDOM() LIMIT 1
产生以下异常:1st ORDER BY term does not match any column in the result set
但是,更改ORDER BY RANDOM()
为ORDER BY colour
能够产生结果(按颜色字母顺序而不是随机排序)。以下建议ORDER BY RANDOM() LIMIT 1
应该有效:从 sqlite table 中选择随机行。有人可以解释为什么我的查询不起作用吗?