问题
I'm trying execute this query in SQLite:
SELECT *
FROM customers
WHERE rating = ANY
(SELECT rating
FROM customers
WHERE city = 'Rome');
But received this error:
Query Error: near "SELECT": syntax error Unable to execute statement
If I replace
rating = ANY
to rating IN
, everything works fine.
Can someone show me how ANY statement works in SQLite and what I am doing wrong?
回答1:
AFAIK, SQLite doesn't have an ANY
operator. You could, however, use the IN
operator to get the required functionality:
SELECT *
FROM customers
WHERE rating IN -- Here!
(SELECT rating
FROM customers
WHERE city = 'Rome');
回答2:
Well, there is no ANY
keyword in SQLite, therefore it won't work.
来源:https://stackoverflow.com/questions/35333660/sqlite-syntax-for-operator-any