10

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?

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Aksios
  • 103
  • 1
  • 1
  • 7

2 Answers2

14

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');
Mureinik
  • 297,002
  • 52
  • 306
  • 350
-2

Well, there is no ANY keyword in SQLite, therefore it won't work.

Jörn Buitink
  • 2,906
  • 2
  • 22
  • 33