How to update multiple rows

From: venkat <ven(dot)tammineni(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: How to update multiple rows
Date: 2010-10-26 07:07:44
Message-ID: AANLkTim4QDfbyss7C_qB=ezUc-ZQiPDDj3qyLUwbCH2L@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Dear All,

I want to update multiple row in single query.I am trying for below
query.I am getting error as

"ERROR: more than one row returned by a subquery used as an expression
SQL state: 21000"

Here is my Query.

update parcelsdata set gid=(select random() * 10),
kasarano=(select kasarano from parcelsdata),
murabano=(select murabano from parcelsdata),
the_geom = (select
(st_dump(st_polygonize(st_union(st_boundary(the_geom), the_line)))).geom as
the_geom from
(select gid,kasarano,murabano,st_linefromtext('LINESTRING('
||(st_xmin(the_geom)-1)::text||'
'||(st_ymax(the_geom)-the_length)||',
'||st_xmax(the_geom)+1||'
'||st_ymax(the_geom)-the_length||')',24047) as the_line, the_geom from
(select 100 as the_length, * from parcelsdata) a) b
where gid = 113 GROUP BY gid,kasarano,murabano)

where kasarano='1' and murabano='119'

Please let me know.I am waiting for your great response.

Thanks and Regards,

Venkat

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2010-10-26 08:02:20 Re: How to update multiple rows
Previous Message zhong ming wu 2010-10-26 01:29:18 Re: What is "return code" for WAL send command

Browse pgsql-sql by date

  From Date Subject
Next Message Alban Hertroys 2010-10-26 08:02:20 Re: How to update multiple rows
Previous Message Axel Rau 2010-10-25 19:01:40 Re: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause [re-post]