MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » July 2008

Update of table from secondard table.



fixed

I need to update a field in a table with the data coming from a secondary table.
I have used something like the following in the past to do this.

Update ITEMBL a
Set a.UUD1IB =
(Select Coalesce(Max(b.PAPPRDT),0) As ApprvDate
From PLNREQ b
Where b.PAPPRDT > 0 And
a.ITNBR = b.PITEM And
a.HOUSE = b.PWH)

My problem this time is that I only want to update the ITEMBL record if there is
a record in the UPDATELIST and the following query fails because not all the
items in ITEMBL are in the UPDATELIST. How would I modify this query to update
only the items that are in the UPDATELIST table?

Update ITEMBL t1
Set UUD1IB = (
Select NEW_THRU
From UPDATELIST t2
Where t1.HOUSE = t2.WAREHOUSE And
t1.ITNBR = t2.ITEM)

Any help would be appreciated.





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact