Re: string_agg distinct order by
| От | Tom Lane |
|---|---|
| Тема | Re: string_agg distinct order by |
| Дата | |
| Msg-id | 1761171.1629390645@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | string_agg distinct order by ("Markhof, Ingolf" <ingolf.markhof@de.verizon.com>) |
| Ответы |
Re: [E] Re: string_agg distinct order by
|
| Список | pgsql-general |
"Markhof, Ingolf" <ingolf.markhof@de.verizon.com> 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...
The reason for that restriction is that the case you propose is
ill-defined. If we combine rows with the same col_x, which row's
value of col_y is to be used to sort the merged row? I think once
you answer that question, a suitable query will suggest itself.
regards, tom lane
В списке pgsql-general по дате отправления: