Delete from zpofilld
Where pzcono || pzcsno || pzwhid || pzrqsd || pzcspo || pzitno || pzqtor
in (SELECT a.pzcono || a.pzcsno || a.pzwhid || a.pzrqsd || a.pzcspo ||
a.pzitno || a.pzqtor
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 )
Regards,
Guy
"Rowe, Sheri"
<srowe@xxxxxxxxx> To: <rpg400-l@xxxxxxxxxxxx>
Sent by: cc:
rpg400-l-bounces@m Subject: Delete with an inner join
idrange.com
06/03/2008 11:12
AM
Please respond to
RPG programming on
the AS400 /
iSeries
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. I looked in the archive and in some
manuals but can't find an exact sample to figure out what I am doing
wrong.
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.