Tom, I see your point. Which is valid considering there could be any value
in col_y for some value in col_x. But in my case, col_y is a a function of
col_x, i.e. two rows with the same value in row_x will have the same value
in row_y as well.
Consider, you need to store some length values. Like t
I believe that you could define an enumerated type to use for those status
colors such that the ordering is defined as you like without two separate
columns for the name and sort_value or whatever.
https://www.postgresql.org/docs/current/datatype-enum.html
Example in the documentation expanded a
"Markhof, Ingolf" writes:
> I am looking for something like
> string_agg(distinct col_x order by col_y)
> Unfortunately, you can either have the distinct, but then the order by
> needs to be identical to what's aggregated, or you can have the order be
> determined by another column. Not both...
On Thu, Aug 19, 2021 at 9:09 AM Markhof, Ingolf <
ingolf.mark...@de.verizon.com> wrote:
>
>
> string_agg(distinct status,',' order by status) as list
>
> but this is not what I want: 'green' would get first, red second, yellow
last...
>
> I could also drop the distinct and say:
>
> string_agg(statu
I am looking for something like
string_agg(distinct col_x order by col_y)
Unfortunately, you can either have the distinct, but then the order by
needs to be identical to what's aggregated, or you can have the order be
determined by another column. Not both...
Here is the playground
Given:
crea