Suppose you have columns
ID | A | B | C
1 | 3 | 1 | 2
2 | 5 | 9 | 1
3 | 1 | 2 | 3
and you want the columns concatenated such that the end result would look like
ID | ABC_value_DESC | ABC_value_DESC_colnames
1 | 3,2,1 | A,C,B
2 | 9,5,1 | B,A,C
3 | 3,2,1 | C,B,A
where you want to get the col values in Descending order within the new column ABC_value_DESC
and then return corresponding name of column in the new column ABC_value_DESC_colnames
.
How can you do the concatenation of values of multiple columns into a new column in Descending order and return column names by value order (not name order) in Vertica 9?
Ps. I have tried Listagg -function but bugs such that ordering not implemented and when tried Vertica's suggestion here giving false result and even bugs with alternative here.