Re: How to remove duplicates in an array and maintain the order?

Поиск
Список
Период
Сортировка
От Marcos Pegoraro
Тема Re: How to remove duplicates in an array and maintain the order?
Дата
Msg-id CAB-JLwY+FKxi-SHM_HQXgYO6uxJu2bb1qgUqjNQyQBgnS9DPhQ@mail.gmail.com
обсуждение исходный текст
Ответ на How to remove duplicates in an array and maintain the order?  (Shaozhong SHI <shishaozhong@gmail.com>)
Список pgsql-sql
How to remove duplicated values in an array and maintain the order?

select array_agg(unnest) filter (where row_number = 1) from (select unnest, ordinality, row_number() over(partition by unnest order by ordinality) from (select * from unnest('{7,7,5,6,2,2,3,8,5,4,5}'::integer[]) with ordinality) x order by ordinality) x

{7,5,6,2,3,8,4}

regards
Marcos 

В списке pgsql-sql по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: How to remove duplicates in an array and maintain the order?
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: How to remove duplicates in an array and maintain the order?