15.10 - Example: Using JSON_AGG with Multiple GROUP BY and Parameter Names - Teradata Database

Teradata Database Teradata JSON

Product
Teradata Database
Release Number
15.10
Published
December 2015
Language
English (United States)
Last Update
2018-06-05
dita:mapPath
TeradataJSON_15_10.ditamap
dita:ditavalPath
ft:empty
The example shows how to assign parameter names and use the GROUP BY clause.
SELECT JSON_agg(empID AS id, empName AS name) 
FROM emp_table
GROUP BY company, empAge;
Result:
JSON_AGG(empID AS id,empName AS name)
--------------------------------------------------------------------------
{"id":2,"name":"Justin"}
[{"id":3,"name":"Someone"},{"id":1,"name":"Cameron"}]