Search Postgresql Archives

Re: How to remove an item from integer array type

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

 



It works!

Thank you,
Choon Park

On Wed, Feb 20, 2013 at 12:06 PM, Russell Keane <Russell.Keane@xxxxxxxxxx> wrote:

 

>>Sorry,

>> 

>>It's not ordered by value. It's not sorted list unfortunately. It can be '{100, 120, 102, 130, 104}'.

>> 

>>Do you have other suggestion?

>> 

>>Thank you,

>>Choon Park

> 

>This should work:

>update a set f2 = (select array_agg(X.id) from (select f1, unnest(f2) id from a where f1 = 1 except select 1 f1, 101 id) X) where f1 = 1;

 

And with the correct table name:

update tableA set f2 = (select array_agg(X.id) from (select f1, unnest(f2) id from tableA where f1 = 1 except select 1 f1, 101 id) X) where f1 = 1;

 

 

 

Regards,

 

Russell Keane

INPS

 

Tel:         +44 (0)20 7501 7277

cid:image001.jpg@01CDBE9B.11D013F0

Follow us on twitter | visit www.inps.co.uk

 

 

 



[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 Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux