我正在尝试在SQLite中执行以下查询:
SELECT * FROM customers WHERE rating = ANY (SELECT rating FROM customers WHERE city = 'Rome');
但是收到了这个错误:
Query Error: near "SELECT": syntax error Unable to execute statement
如果我替换 rating = ANY 为rating IN,则一切正常。
rating = ANY
rating IN
有人可以告诉我 ANY 语句如何在SQLite中工作以及我在做什么错吗?
AFAIK,SQLite没有ANY运算符。但是,您可以使用IN运算符来获取所需的功能:
ANY
IN
SELECT * FROM customers WHERE rating IN -- Here! (SELECT rating FROM customers WHERE city = 'Rome');