ARRAY_AGGを使用して、職種の給与を集約します。
例では、以前に作成したテーブルを使用します。
SELECT salary, ARRAY_AGG(pos ORDER BY empId, NEW varchararr5()) FROM employeeTable GROUP BY salary ORDER BY salary;
結果:
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')