How can I use MySQL IN() function to compare row constructors?

MySQLMySQLi Database

We can also use IN() function to compare row constructors. Consider the following example to make it clearer −

mysql> Select (10,2) IN ((5,10),(10,2),(2,10),(100,100));
+--------------------------------------------+
| (10,2) IN ((5,10),(10,2),(2,10),(100,100)) |
+--------------------------------------------+
| 1                                          |
+--------------------------------------------+
1 row in set (0.00 sec)

mysql> Select (10,2) IN ((5,10),(2,10),(100,100));
+-------------------------------------+
| (10,2) IN ((5,10),(2,10),(100,100)) |
+-------------------------------------+
| 0                                   |
+-------------------------------------+
1 row in set (0.00 sec)
raja
Published on 21-Feb-2018 09:51:02
Advertisements