Re: Update Help - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: Update Help
Date
Msg-id Pine.LNX.4.44.0209032035070.1157-100000@localhost.localdomain
Whole thread Raw
In response to Update Help  ("Yudie@axiontech.com" <yudie@axiontech.com>)
List pgsql-sql
Yudie@axiontech.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@gmx.net



pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: UPDATE & LIMIT together?
Next
From: Tom Lane
Date:
Subject: Re: Outer Join with For Update