Re: UPDATE QUERY

From: Gary Assa <gsa_at_li.net>
Date: 1996/09/13
Message-ID: <51blmp$gtf_at_linet01.li.net>#1/1


>
>I am trying to write an UPDATE query. I have 2 tables.
>Both have a part # and cost field. I want to match
>the tables on part # and update the price on one table
>with the price in the other table.
>
update TABLE1 T set PRICE = (select PRICE from TABLE2

   where PARTNUM=T.PARTNUM)
where PARTNUM in (select PARTNUM from TABLE2);

The last where clause is very important. If you didn't use it, all the prices would be nulled out if it didn't find the part number in the second table.

-- 
=========================================================
            http://www.li.net/~gsa/index.html
This is my signature file, not part of this mail message.
Received on Fri Sep 13 1996 - 00:00:00 CEST

Original text of this message