× 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.



shouldn't

z.pzqtor = 0

be outside of the where exists clause as it belongs to the file you are
trying to delete from. Also why not say...

d.obortp = h.oaortp

instead of saying what you have...

d.obortp = 'I' and h.oaortp = 'I'


Michael Schutte
Admin Professional

Bob Evans Bob-B-Q: You haven't had barbeque until you've had Bob Evans
Bob-B-Q. Try our six Bob-B-Q dishes, starting at $5.99. For more
information, visit www.BobEvans.com.


rpg400-l-bounces@xxxxxxxxxxxx wrote on 06/03/2008 12:54:09 PM:

Thanks Michael and Guy for your responses. I tried the following code
but it only deletes about 1/2 the records I need deleted. Can you tell
me what I am doing wrong? Thanks.

delete FROM zpofilld z where exists
( select * from hsdet d inner join hshed h ON
h.oacono = d.obcono and z.pzcono = d.obcono
AND h.oacsno = d.obcsno and z.pzcsno = d.obcsno
AND h.oaorno = d.oborno and z.pzitno = d.obitno
AND h.oaorgn = d.oborgn and z.pzwhid = d.obwhid
and h.oarqsd = z.pzrqsd and h.oacspo = z.pzcspo
and d.obortp = 'I' and h.oaortp = 'I'
and z.pzqtor = 0)
1088 rows deleted from ZPOFILLD in SROWETEST.


************************************************************************
***

Hi,

Can anyone help me with this SQL statement? I have written a select
statement that works, but I need to convert it to a DELETE statement but
can't get it to work correctly.

SELECT a.pzcono, a.pzcsno, a.pzwhid, a.pzrqsd, a.pzcspo, a.pzitno,
a.pzqtor, b.obqtor, a.pzqtsh, b.obqtsh, a.pzlfcd, b.oborno, b.oborgn

FROM zpofilld A
inner join hsdet B ON
A.pzcono = B.obcono
AND A.pzcsno = B.obcsno
AND A.pzitno = B.obitno
AND a.pzwhid = B.obwhid
inner join hshed d ON
A.pzcono = d.oacono
AND A.pzcsno = d.oacsno
AND A.pzrqsd = d.oarqsd
and a.pzcspo = d.oacspo
and d.oaorno = B.oborno
WHERE d.oaortp = 'I' and a.pzqtor = 0
ORDER BY 2,1

Any help would be appreciated. Thanks.


Sheri
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

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.