15.10 - Example: Use ARRAY_AGG to Aggregate Salaries - 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
Use ARRAY_AGG to aggregate the salaries of the job positions.
The example uses the table(s) created earlier.
SELECT salary, ARRAY_AGG(pos ORDER BY empId, NEW varchararr5()) 
FROM employeeTable 
GROUP BY salary
ORDER BY salary;
Result:
salary 	 ARRAY_AGG(pos ORDER BY empId ASC, NEW varchararr5())
-------------------------------------------------------------
50000 ('engineer','engineer','salesman','salesman','manager')
75000 ('engineer','salesman','manager')
100000  ('engineer','salesman','manager')
125000  ('manager','executive')
150000  ('executive','executive')
200000  ('executive')
1000000 ('executive')