Search Postgresql Archives

Arrays - selecting (and not removing) duplicates...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Suppose I have two arrays (TEXT, INT - not important - prefer INT) as follows:

x = {1, 4, 5, 6, 6, 7, 8, 9, 9, 9, 9, 10, 12, 12}

I would like a result of:

y = {6, 9, 12}

I'm aware of the UNNEST function and that I can convert the array into
rows and do a COUNT(blah) HAVING COUNT(blah) > 1 and then ARRAY_AGG
back.

I was just wondering if there is some (already written) function out
there that will drop this functionality into my lap?

TIA and Rgs,


Pól...






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux