Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter only for Instances where "Y" and "N" apply

Status
Not open for further replies.

Elysynn

Technical User
Mar 18, 2004
82
US
Hello all,

It's been a few months since I've worked in Access and used SQL and I feel like I've lost almost everything =( I am probably missing something very simple with this issue, so I'm hoping you can kick-start my brain...

Here is my dilemma:

I have a table of data in which there can be several records for each member. In the instances where there is more than one record, i need to filter for where the CoverageActive field is both "Y" and "N"

Example:

Member# CovActive
123456 Y
123456 N
654321 Y
654321 Y
987654 N

I want the query to only return member 123456.

This is the SQL I have that is not working:
Code:
SELECT qryTermed4.MCN, qryTermed4.[COVG_ ACTIVE _FLAG]
FROM qryTermed4
WHERE (((qryTermed4.[COVG_ ACTIVE _FLAG])="Y" And (qryTermed4.[COVG_ ACTIVE _FLAG])="N"));

Thanks,
Elysynn


 
Does this work for you?
Code:
SELECT A.MCN
FROM   qryTermed4 As A
       Inner Join qryTermed4 As B
          On A.MCN = B.MCN
          And A.[COVG_ ACTIVE _FLAG] = 'Y'
          And B.[COVG_ ACTIVE _FLAG] = 'N'

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top