Hi all,

Normally I would ask an SQL person at work to write any complex SQL for me
but I am trying this myself. Mistake #1.

I am trying to delete A/P details where the A/P header has a last payment
date of 121213 (yesterday).

Two things:

1. Why does the IBM i not allow the same syntax as what I've found on the
Net for other platforms? Is it the i or the other platforms that aren't
standard? eg. I'm getting the error message "Keyword FROM not expected.
Valid tokens: USE SKIP WAIT WITH WHERE." for the following statement:
DELETE D
FROM IPAPDTL D
INNER JOIN IPAPHDR H ON
H.AAVN=D.DAVN AND H.ATYP=D.DTYP AND H.AINV=D.DINV AND
H.AIDI=D.DIDI AND H.AGS$=D.DGS$
WHERE H.ADLP = 121213

2. Why did the following statement delete all my records?!
DELETE FROM IPAPDTL
WHERE EXISTS (
SELECT D.*
FROM IPAPDTL D, IPAPHDR H
WHERE H.AAVN=D.DAVN AND H.ATYP=D.DTYP AND H.AINV=D.DINV AND
H.AIDI=D.DIDI AND H.AGS$=D.DGS$ AND H.ADLP = 121213 )


Yours truly,

Glenn Gundermann
ggundermann@xxxxxx
Cell: 416-317-3144


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.