Re: Update Help

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "Yudie(at)axiontech(dot)com" <yudie(at)axiontech(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Update Help
Date: 2002-09-03 18:55:52
Message-ID: Pine.LNX.4.44.0209032035070.1157-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Yudie(at)axiontech(dot)com writes:

> Let say I have 2 Product table, both of them has columns ProductID and
> Price What is the update command if I want to update all Prices of first
> table to be equal with Price in second table?

Possibly you mean something like this:

UPDATE first_table SET price = (SELECT price FROM second_table WHERE
second_table.productid = first_table.productid);

Possibly the answer is also to redesign your schema to avoid redundant
data.

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

  • Update Help at 2002-09-03 16:38:30 from Yudie@axiontech.com

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-09-03 21:31:19 Re: Outer Join with For Update
Previous Message Oleg Bartunov 2002-09-03 18:42:44 Re: tree structures in sql - my point of view (with request