Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite syntax for operator “ANY”

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?

like image 758
Aksios Avatar asked Mar 28 '26 20:03

Aksios


1 Answers

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');
like image 164
Mureinik Avatar answered Apr 01 '26 08:04

Mureinik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!