Let's say I have a query returning a table of production jobs, and in one column I have an array of output on each job for the past 7 days:
sku | job | outputs
-----------------------------
A1 | 123 | {2,4,6,5,5,5,5}
A1 | 135 | {0,0,0,3,5,7,9}
B3 | 109 | {3,2,3,2,3,2,3}
C5 | 144 | {5,5,5,5,5,5,5}
How can I write a query that will group by SKU (product number) and sum the 7-day outputs by position? In this case you can see there are two production jobs for product A1: these should be consolidated into one row of the result:
sku | outputs
--------------------------
A1 | {2,4,6,8,10,12,14}
B3 | {3,2,3,2,3,2,3}
C5 | {5,5,5,5,5,5,5}