I need some help to create a function to order:
- first the element inside an array;
- second order by the column;
I will try to explain through an example:
id | names |
- - - - - - - - -
1 |{ad, ab, cd}|
2 |{aa, ac} |
3 |{cd, da} |
The result of ORDER BY names
should be
id | names |
- - - - - - - - -
2 | {aa, ac} |
1 | {ab, ad, cd}|
3 | {cd, da} |
I already tried this solution - Sorting array elements - but it doesn't work for me.
UPDATE: I think I get a point. I sorted inside the array but I don't change the order - I need an update on that. Probably I have to create a kind of virtual array (I don't know how to do that) and store the value which I sorted.