|
Why join the files? Might not the following work?
UPDATE FILE1
SET STATUS=X
WHERE CUSNO IN (SELECT CUSNO FROM FILE2 WHERE .....)
jmoreno@militarycars.com on 04/15/99 04:44:26 PM
Please respond to MIDRANGE-L@midrange.com@Internet
To: MIDRANGE-L@midrange.com@Internet
cc:
Subject: ##EMailNumber 01-WNY-3332161 SQL How To ...
Hello all.
I have a simple SQL question to the SQL/400 and Query Management/400 GURUS
I have two different files FILE 1 and FILE 2 that I am joining by common
fields.
Say customer number: CUSNO and STATUS in FILE 1 equal to "M".
Once the JOINED file is created, I can use an RPG pgm to READ the JOINED
file
and issue UPDATES against FILE 1 .....Change STATUS code to "X".
FILE 1 FILE 2
---------- --------------
CUSNO CUSNO
STATUS
I do not care who is the primary or secondary file in this question ...
Part 1:
For simplicity there are no duplicate CUSNO in FILE 1 and/or FILE 2.
How do I execute this using SQL in a SINGLE or MULTIPLE statement (s) ?
Part 2:
How do I the same in case of Duplicates in FILE 1 and NO Duplicates in FILE 2 ?
Part 3:
How do I do the same in case of Duplicates in FILE 1 and FILE 2 ?
I just wanted to ask .. before it is too late .... <bg>
All answers are appreciated
Regards
Jorge
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.