|
Thanks Elvis and Charles, Almost there! When I run the statement: WITH preserve AS (SELECT SCACCODE,TRLRNUM,ASNNUM,ORDERTYP,ORDERNUM,MIN(KDLOTSTR) AS KDLOTSTR FROM SSW85 GROUP BY SCACCODE, TRLRNUM, ASNNUM, ORDERTYP, ORDERNUM) (DELETE FROM SSW85 A,preserve P WHERE A.SCACCODE = P.SCACCODE AND A.TRLRNUM = P.TRLRNUM AND A.ASNNUM = P.ASNNUM AND A.ORDERTYP = P.ORDERTYP AND A.ORDERNUM = P.ORDERNUM AND A.KDLOTSTR <> P.KDLOTSTR) The system balks at the (DELETE FROM SSW85...) statement with the error "Keyword DELETE not expected. Valid tokens: ( SELECT." However, when I change it to: WITH preserve AS (SELECT SCACCODE,TRLRNUM,ASNNUM,ORDERTYP,ORDERNUM,MIN(KDLOTSTR) AS KDLOTSTR FROM SSW85 GROUP BY SCACCODE, TRLRNUM, ASNNUM, ORDERTYP, ORDERNUM) (SELECT * FROM SSW85 A,preserve P WHERE A.SCACCODE = P.SCACCODE AND A.TRLRNUM = P.TRLRNUM AND A.ASNNUM = P.ASNNUM AND A.ORDERTYP = P.ORDERTYP AND A.ORDERNUM = P.ORDERNUM AND A.KDLOTSTR <> P.KDLOTSTR) I get back all the data I need to complete this query. I'll keep playing with it to see if I can get it to either delete the rows in question or dump the results into another table. However, any other ideas would be most appreciated. Thanks all! Brian.
As an Amazon Associate we earn from qualifying purchases.
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.