SQLite syntax for operator “ANY”

£可爱£侵袭症+ 提交于 2021-01-26 09:25:13

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!