Re: update ... set ... subquery

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: John Smith <jayzee(dot)smith(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: update ... set ... subquery
Date: 2010-03-17 20:20:35
Message-ID: 20100317202035.GA10562@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 17, 2010 at 03:13:26PM -0400, John Smith wrote:
> guys,
> trying multiple updates without success like so:
>
> update a
> set number = any ( select number from b where a.number=b.number)
> where number is null;
> >> 'syntax error at or near "any"'
>
> subquery returns more than one row. using 8.1.
> thks, jzs

make is: number in ( select number from ...

number = any () is syntax for arrays.

depesz

--
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Smith 2010-03-17 20:40:17 Re: update ... set ... subquery
Previous Message Carsten Kropf 2010-03-17 19:56:05 Re: building a c function