|
I built your sample files and made the date a date data type:
select * from file1 f1 inner join file2 f2
on f1.acctno = f2.acctno
where f2.acctno not in (select acctno from file2
where year(fldz)>=2000)
The result set:
ACCTNO FLD1 FLD2 FLD3 ACCTNO FLDX FLDY FLDZ
456 a a a 456 c d 1999-10-01
456 a a a 456 c d 1999-12-31
Refine this to suit your needs and you should be all set.
Bob
Bob Slaney/Atlanta/IBM @ IBMUS (Lotus Notes)
VM id: WTSCPOK.RJSLANEY@VM
Internet id: rjslaney@us.ibm.com
Tieline 596-3022 Direct (770)835-3022
Fax tie 596-3912 Direct (770)835-3912
IBM Learning Services
IBM Corp.
3100 Windy Hill Road
Atlanta, GA 30339
Internal Zip WE3A1
---------------------- Forwarded by Bob Slaney/Atlanta/IBM on 12/15/99
03:10 PM ---------------------------
Gade_R_Reddy@consecofinance.com@midrange.com on 12/15/99 02:20:32 PM
Please respond to RPG400-L@midrange.com
Sent by: owner-rpg400-l@midrange.com
To: RPG400-L@midrange.com
cc:
Subject: Sql Question
Hey Guys,
I got a question in SQL which i want to run from my RPGLE program.
I have two files..
File1
Acctno Fld1 Fld2 Fld3
123 a a a
456 b b b
File2
Acctno FldX FldY FldZ
123 a1 b1 19991011
123 a1 b1 19991105
123 a1 b1 20020106
456 a2 b2 19991001
456 a2 b2 19991231
Now i want to write a Sql which does the following..
- Want to print all the Acctno & FldZ where Acctno matches in both the
files and only if no record in file2 has FldZ value > 20000000
So if i run the sql statement with the above data i want the output to be
AcctNo FldZ
456 19991231 ( because the two records has FldZ value < 20000000 but
in acctno 123 we have one record whose FldZ value > 20000000 )
Any suggestions please.
Gade.
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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.