|
Thanks, Jim. Worked like a charm.
Update ALANC/ITEMBL t1
Set UUD1IB = (
Select NEW_THRU
From ALANC/UPDATELIST t2
Where t1.HOUSE = t2.WAREHOUSE And
t1.ITNBR = t2.ITEM)
Where Exists
(Select 1
From ALANC/UPDATELIST t2
Where t1.HOUSE = t2.WAREHOUSE And
t1.ITNBR = t2.ITEM)
-------------- Original message ----------------------
From: "Jim Essinger" <dilbernator@xxxxxxxxx>
You will need a "WHERE EXISTS" clause. See the following thread from the
archives;
http://archive.midrange.com/midrange-l/200801/msg00521.html
HTH
Jim
On Mon, Jul 14, 2008 at 2:47 PM, <alancampin@xxxxxxxxxxx> wrote:
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.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.