JSON_ARRAYAGG
各入力 SQL 式の集計を JSON 値に変換し、それらの JSON 値を含む単一の JSON アレイを返します。
構文
<JSON array aggregate constructor> ::= “JSON_ARRAYAGG” “ (“ <JSON value expression>
[ "ORDER BY" <sort specification list> ] [ "NULL ON NULL" | "ABSENT ON NULL" ] “) ”
<sort specification list> ::= <sort specification> [ { "," <sort specification> }... ]<sort specification> ::= <sort key> [ "ASC" | "DESC" ] [ NULLS FIRST | NULLS LAST ]
ルール
|
2.
|
ABSENT ON NULL は暗黙的です。 |
|
3.
|
数値型、ブール型、null 型以外に、JSON 値は文字列にするか、文字列としてキャストする必要があります。 |
|
4.
|
関数によって取得された行が 0 の場合は null を返します。 |
例
SELECT JSON_ARRAYAGG (customerid) a1 FROM /shared/examples/ds_orders/tutorial/customers GROUP BY customerid HAVING JSON_ARRAYAGG (customerid) ='[]'