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

Teradata Database Teradata JSON

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1150-151K
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"}]