pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: Yudie@axiontech.com <yudie@axiontech.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Update Help
Date: Tue, 3 Sep 2002 20:55:52 +0200 (CEST)
Message-ID: <Pine.LNX.4.44.0209032035070.1157-100000@localhost.localdomain> (raw)
In-Reply-To: <001a01c25368$5b374c10$8a01a8c0@yudie>

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




view thread (12+ messages)  latest in thread

Message-ID: <Pine.LNX.4.44.0209032035070.1157-100000@localhost.localdomain>
Permalink:  ../Pine.LNX.4.44.0209032035070.1157-100000@localhost.localdomain/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0209032035070.1157-100000@localhost.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: peter_e@gmx.net, yudie@axiontech.com
  Subject: Re: Update Help
  In-Reply-To: <Pine.LNX.4.44.0209032035070.1157-100000@localhost.localdomain>
  References: <001a01c25368$5b374c10$8a01a8c0@yudie> <Pine.LNX.4.44.0209032035070.1157-100000@localhost.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox