JSON_OBJECTAGG()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Enterprise Server
Topics on this page:
Overview
EXAMPLES
CREATE TABLE t (c1 VARCHAR(25), c2 INT);
INSERT INTO t VALUES ('a', 1), ('b', 2), ('c', 3);
SELECT c1, c2 FROM t;
+------+------+
| c1 | c2 |
+------+------+
| a | 1 |
| b | 2 |
| c | 3 |
+------+------+
SELECT JSON_OBJECTAGG(c1, c2) FROM t;
+------------------------+
| JSON_OBJECTAGG(c1, c2) |
+------------------------+
| {"a":1, "b":2, "c":3} |
+------------------------+