hey guys,
I am creating a query that will simply list everyone who does not have a stat_cd of 3.
I discovered a problem when I found one account that did have a stat_cd of 3 even though I specified in my query to ignore all 3's.
The problem has something to do with the fact that they have two records in the table and one of the records has 3. Why doesn't SQL evaluate all records, or does it just look at the first one?
Here is the table:
My query is
So how do I keep this sample SSN from being including in my query results? I tried a self table join, but that didn't seem to work.
I am creating a query that will simply list everyone who does not have a stat_cd of 3.
I discovered a problem when I found one account that did have a stat_cd of 3 even though I specified in my query to ignore all 3's.
The problem has something to do with the fact that they have two records in the table and one of the records has 3. Why doesn't SQL evaluate all records, or does it just look at the first one?
Here is the table:
Code:
SSN Enroll Date Stat Code
2345 04-03-07 4
2345 04-03-08 3
My query is
Code:
select distinct A.mbr_ssn_nbr
from dsnp.pr01_t_mbr_sys A
where A.mbr_stat_cd not in ('3')
So how do I keep this sample SSN from being including in my query results? I tried a self table join, but that didn't seem to work.