Thinking about this, I realized I may have misunderstood what you're trying to do. Do you want to update all the records in the a file that have matching mxplan, mxdiv, mxins, mxben, and mxppo records in the b file? Or do you only want to update those
records in the a file that also have mxtfrm='V' and mxtdt=0? The statement I posted earlier should to the latter; for the former, you might try:

Exec Sql
Update plnmaxl1 as a
Set a.mxUdt = :xDate,
a.mxUtm = :xTime,
a.mxUop = 'SPR33684',
a.mxCpdy = 'Y',
a.mxUty = 'C'
Where exists
(select * from xplnMax as b
where a.mxplan = b.mxplan and
a.mxdiv = b.mxdiv and
a.mxins = b.mxins and
a.mxben = b.mxben and
a.mxppo = b.mxppo)
and exists
(select * from plnMax as c
where a.mxplan = c.mxplan and
a.mxdiv = c.mxdiv and
a.mxins = c.mxins and
a.mxben = c.mxben and
a.mxppo = c.mxppo and
c.mxtfrm = 'V' and
c.mxtdt = 0);

Seems a little cumbersome, but that might be what you need to do ....

Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx> writes:
I'm not sure I can explain it, but I think you want to take the tests for a.mxtfrm and a.mxtdt out of your EXISTS clause, since they don't care about anything in xRouteMax:

Exec Sql
Update plnmaxl1 as a
Set a.mxUdt = :xDate,
a.mxUtm = :xTime,
a.mxUop = 'SPR33684',
a.mxCpdy = 'Y',
a.mxUty = 'C'
Where a.mxtfrm = 'V'
and a.mxtdt = 0
and exists
(select * from xplnMax as b
where a.mxplan = b.mxplan and
a.mxdiv = b.mxdiv and
a.mxins = b.mxins and
a.mxben = b.mxben and
a.mxppo = b.mxppo);


Mike Naughton
Senior Programmer/Analyst
Judd Wire, Inc.
124 Turnpike Road
Turners Falls, MA 01376
413-676-3144
Internal: x 444
mnaughton@xxxxxxxxxxxx
****************************************
NOTICE: This e-mail and any files transmitted with it are confidential and solely for the use of the intended recipient. If you are not the intended recipient or the person responsible for delivering to the intended recipient, be advised that any use is
strictly prohibited. If you have received this e-mail in error, please notify us immediately by replying to it and then delete it from your computer.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.