pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Elphick <olly@lfix.co.uk>
To: Yudie@axiontech.com <yudie@axiontech.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Update Help
Date: 03 Sep 2002 19:01:21 +0100
Message-ID: <1031076081.18322.25.camel@linda> (raw)
In-Reply-To: <001a01c25368$5b374c10$8a01a8c0@yudie>
References: <001a01c25368$5b374c10$8a01a8c0@yudie>

On Tue, 2002-09-03 at 17:38, Yudie@axiontech.com wrote:

> 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?

UPDATE table1
   SET price = 
      (SELECT price
         FROM table2
        WHERE table1.product = table2.product);


-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                            
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "And he said unto his disciples, Therefore I say unto 
      you, Take no thought for your life, what ye shall eat;
      neither for the body, what ye shall put on. For life 
      is more than meat, and the body is more than clothing.
      Consider the ravens, for they neither sow nor reap; 
      they have neither storehouse nor barn; and yet God  
      feeds them;  how much better you are than the birds!
      Consider the lilies, how they grow; they toil 
      not, they spin not; and yet I say unto you, that  
      Solomon in all his glory was not arrayed like one of 
      these. If then God so clothe the grass, which is to 
      day in the field, and tomorrow is cast into the oven;
      how much more will he clothe you, O ye of little  
      faith?  And seek not what ye shall eat, or what ye 
      shall drink, neither be ye of doubtful mind. 
      But rather seek ye the kingdom of God; and all these 
      things shall be added unto you."         
                              Luke 12:22-24; 27-29; 31. 




view thread (12+ messages)  latest in thread

Message-ID: <1031076081.18322.25.camel@linda>
Permalink:  ../1031076081.18322.25.camel@linda/
Also on:    postgresql.org/message-id/1031076081.18322.25.camel@linda

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: olly@lfix.co.uk, yudie@axiontech.com
  Subject: Re: Update Help
  In-Reply-To: <1031076081.18322.25.camel@linda>

* 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