Example: Using JSON_AGG with Multiple GROUP BY and Parameter Names

Teradata Vantage™ JSON Data Type

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1150-162K
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"}]