简体   繁体   中英

“Every” and “Any” not returning value in Maria DB

Every and Any are 2 type of aggregate functions in Maria DB. These functions return true or false based on boolean values in them.

While using MariaDB installed in xampp with following server version , i cannot get these functions tested in my local environment using queries :

select any(column_name) from table_name

Server Version :

Server type: MariaDB
Server version: 10.1.21-MariaDB - mariadb.org binary distribution

Any idea to sort issues ?

Thanks.

What you are pointing at in the knowledge base is not MariaDB syntax, it's SQL-99 standard. In MariaDB (and MySQL ) implementations , ANY , SOME and ALL are not aggregate functions. They aren't exactly functions or operators at all, they are referred to as just "words", used between a comparison operator and a subquery, eg

MariaDB [test]> CREATE TABLE t1 (f1 INT);
MariaDB [test]> CREATE TABLE t2 (f2 INT);
MariaDB [test]> INSERT INTO t1 VALUES (1),(2),(3),(4);
MariaDB [test]> INSERT INTO t2 VALUES (1),(2);

MariaDB [test]> SELECT * FROM t1 WHERE f1 > ANY( SELECT f2 FROM t2 );
+------+
| f1   |
+------+
|    2 |
|    3 |
|    4 |
+------+
3 rows in set (0.00 sec)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM