在 SQLite 中执行查询时出现以下错误:
4th ORDER BY term does not match any column in the result set
我的查询:
select * from Users where deleted != 1 AND DATE(created) <= '2013-10-09' and
DATE(created) >= '2013-09-09T12:41:55.261Z' UNION select * from Users where deleted != 1 AND
owner NOT IN(Select userid from Customer)
order by Type DESC,License ASC,NUM ASC,"MCTD#" ASC,Name DESC;
然而,具有单个查询的等效项,即没有 UNION似乎工作正常。
ORDER BY项必须在结果集中是否有任何限制?如果是这样,为什么在没有UNION的情况下它不启动?
我曾经从用户中选择所有,所以它应该从用户表中获取所有列。那么为什么会出现这个异常呢?