SQL 101

From: Keith Lowdon <klowdon_at_mts.net>
Date: Sun, 3 Oct 1999 07:58:24 -0500
Message-ID: <tqIJ3.938$ti4.28719_at_news1.mts.net>



Table 1 : UWI
Fields: UWI varchar2(21) - primary key
           Licence:  Number(4)
           blah ...
           blah...

Table 2 Drilling Events
Fields: Licence Number(4)

           UWI varchar2(21) this field is empty
           blah
           blah

Table 2 is having the uwi values added to it due to change in design. The relationship between the uwi.licence and drilling_events.licence is one to many.

How would the query be constructed to perform this update? This would be some form of correlated update query but I'm not sure how to do it. If I do the following:
UPDATE drilling_events set licence = (
SELECT licence from uwi
WHERE drilling_events.licence =
uwi.licence)
an error will be returned indicating because of the number of records with the same licence in drilling_events.

Any help would be appreciated. Received on Sun Oct 03 1999 - 14:58:24 CEST

Original text of this message