Request for validation of a couple queries (kind of lengthy - sorry)

G

Gary

Hi,

I was wondering if someone could look at this issue
and 'validate' whether I am on the right track (a second
opinion?).

A long time ago our system was set up to assign a unique
participant number to every person with a SSN number (a
one-to-one ratio). Over time, some SSN's and participant
numbers became out of sync and there are now entries where
one SSN may have two or more different participant
numbers. I'm trying to create a list of SSN's that have
multiple different participant numbers so that they can
eventually be corrected (which I think I've figured out).

* Note - I'm not concerned with instances of the same
SSN and Participant number combination appearing more
than once.

I want to return SSN # 111 22 3333 from example 2 below
because there are different participant numbers associated
with one SSN, but I do not want to return SSN 123 45 6789
from example 1 because there is a one-to-one relationship
with the SSN and participant #.

Example 1

SSN Participant #
123 45 6789 123
123 45 6789 123


Example 2

SSN Participant #
111 22 3333 124
111 22 3333 895


To do this, I've created two queries:
------------
Query 1: [My intent is to count each occurrence of a SSN
and Participant # combination]

SSN SSN
Participant #
Count Group by Group by

--------------
Query 2: [My intent is to, from query 1, only return the
SSN if the SSN appears more than once in query 1]

From Query 1, I Group by SSN, and Count SSN's >1

SSN SSN
Group by Count
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top