|
However, this is what you need to do, do an update with a SUBSELECT. Update rugd80dat.asbacpp set bai1tx = 'N', bai2tx = 'N' (Select * from rugd80dat.asbacpp r1,rugd80dat.pmsp0200 r2 where (r1.baartx = r2.symbol and r1.baastx = r2.policy0num and r1.baadnb = r2.module) and (r1.baartx = 'APV' or r1. baartx = 'MPV' or r1.baartx = 'SPV' or r1.baartx = 'EPV') and (r1.bai1tx = ' ' and r1.bai2tx = ' ') and (r2.trans0stat = 'V' and r2.renewal0cd = '1')) Michael Schutte Work 614-492-7419 email michael_schutte@xxxxxxxxxxxx "John Candidi" <jacandidi@rutger sinsurance.com> To Sent by: <midrange-l@xxxxxxxxxxxx> midrange-l-bounce cc s@xxxxxxxxxxxx Subject SQL - Updates with joins 04/03/2006 02:18 PM Please respond to Midrange Systems Technical Discussion <midrange-l@midra nge.com> I am having a problem generating the correct SQL script run in iSeries Navigator. This is what I have so far: Update rugd80dat.asbacpp set bai1tx = 'N', bai2tx = 'N' from rugd80dat.asbacpp r1,rugd80dat.pmsp0200 r2 where (r1.baartx = r2.symbol and r1.baastx = r2.policy0num and r1.baadnb = r2.module) and (r1.baartx = 'APV' or r1. baartx = 'MPV' or r1.baartx = 'SPV' or r1.baartx = 'EPV') and (r1.bai1tx = ' ' and r1.bai2tx = ' ') and (r2.trans0stat = 'V' and r2.renewal0cd = '1') When run as a select statement, it returns the correct rows. When changed to do the actual update, it reports an unexpected 'from'. Any recommendations? I tried with a 'where exists' with a select subquery, but it ended up hitting all the rows in the asbacpp table, not just the handful in the query result. John A Candidi Rutgers Insurance Companies IT Director - AS/400 Manager 856-779-2274 -- 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.