I am stuck on this one. They want to see a list of people who have service dates occuring before 07-01-1997. I have a field for service date in the table.
The problem is the table contains multiple records for the same person with different service dates. Here is my query:
The problem is that Joe Blow qualifies for my condition because he does have service records in the table before 1997. However, he also has service records in the table occuring after 1997.
I am puzzled how to get SQL to exclude people from the table that has any service date record after 1997.
The table appears like this:
SSN Service Date
11122 1945-05-03
11122 1966-04-06
11122 2005-12-01
I don't want the query to report 11122 because he has service after 1997. Can anyone help? Thanks!
The problem is the table contains multiple records for the same person with different service dates. Here is my query:
Code:
SELECT DISTINCT MBR_SSN_NBR, MBR_HIST_SVC_CR_DT
FROM DSNP.PR01_T_MBR_HIST
WHERE HIST_CATEG_CD = '31'
AND MBR_HIST_SVC_CR_DT < '1997-07-01'
The problem is that Joe Blow qualifies for my condition because he does have service records in the table before 1997. However, he also has service records in the table occuring after 1997.
I am puzzled how to get SQL to exclude people from the table that has any service date record after 1997.
The table appears like this:
SSN Service Date
11122 1945-05-03
11122 1966-04-06
11122 2005-12-01
I don't want the query to report 11122 because he has service after 1997. Can anyone help? Thanks!