× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You could also use the "EXISTS" clause which sometimes is faster and since you are using the iSeries Navigator you can check both methods with Visual Explain and also test both methods by turning on debug for your iSeries SQL connection to check out the details:

Delete from rugd80dat.rcd4cpp A
 Where exists (
  SELECT *
   from rugd80dat.rcd3cpp
  Where A.d4bznb   =  d3bznb
   AND  A.d4bwrtdt =  d3bwrtdt
   AND  d3polsym between '000' and '999'
   AND  d3e3st = 'P'
              );

Start Debug via the menu "Options" or this statment:
CALL QSYS.QCmdExc('STRDBG UPDPROD(*YES)',0000000020.00000);


This will potentially be slow depending on how many records are in the
sub-select.

delete
FROM rugd80dat.rcd4cpp Where <keyfield1 from rcd4cpp> || <keyfield2 from rcd4cpp> || <keyfield3
from rcd4cpp>
In (
SELECT <keyfield1 from rcd4cpp> || <keyfield2 from rcd4cpp> ||
<keyfield3 from rcd4cpp>
FROM rugd80dat.rcd4cpp AS rcd4, rugd80dat.rcd3cpp AS rcd3 WHERE rcd4.d4bznb = rcd3.d3bznb AND rcd4.d4bwrtdt = rcd3.d3bwrtdt AND (rcd3.d3polsym BETWEEN '000' AND '999') AND rcd3.d3e3st = 'P')

I have the folowing SQL query:

SELECT rcd4.* FROM rugd80dat.rcd4cpp AS rcd4, rugd80dat.rcd3cpp AS rcd3
WHERE rcd4.d4bznb = rcd3.d3bznb AND rcd4.d4bwrtdt = rcd3.d3bwrtdt AND (rcd3.d3polsym BETWEEN '000' AND '999') AND rcd3.d3e3st = 'P'


I want to change this to be able to delete the result set, but having
problems with the SQL not wanting to run a delete with multiple tables
in the list.

I am using the iSeries Navigator RUN SQL dialog to try to do this.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.