I have to transpose data of a HANA table into an array on which to create a json
model, so I've got an array like:
[COLOR, TYPE, INFO, DAY, VALUE]
COLOR, TYPE and DAY is the Primary Key and period is the same for all keys:
[BLACK,JEANS,Info01,2020-12-01,25], //start period
[BLACK,JEANS,Info01,2020-12-02,22],
[BLACK,JEANS,Info01,2020-12-03,18],
[BLACK,JEANS,Info01,2020-12-04,33], //end period
[WHITE,SHIRT,Info02,2020-12-01,15], //start period
[WHITE,SHIRT,Info02,2020-12-02,12],
[WHITE,SHIRT,Info02,2020-12-03,58],
[WHITE,SHIRT,Info02,2020-12-04,63], //end period
I would like to transpose it to get the following array:
[BLACK,JEANS,Info01,25,22,18,33],
[WHITE,SHIRT,Info02,15,12,58,63],
Is there an efficient way to do it?
Assuming same dates in order.
You could use a joined key for the first three items and collect the values.