Query Question - Filter Out Certain Records

J

JD

Here's the scenario.. can anyone help?!

I have a spreadsheet that I need to get rid of some fields on, using
certain criteria, but I'm not sure how to do the whole thing.

My issue:
I need to get rid of all records that contain a certain diagnosis code
(2222) that could be in 16 different fields (I chose not to list an
example with 16 fields). Once those fields are identified, there is a
further step needed. In each record, there is a field named, "Claim
ID", and for each claim ID there is a SubmitterID and an individual's
LastName associated with it. And there may be multiple claim ID/last
name records.. but not all claim ID/last name records will have that
certain diagnosis code in it. So, if I find that diagnosis code for
one claim ID and last name, but there are a total of four records that
have that same claim ID and last name combo.. I want to filter out all
four, how do I accomplish that?? Sorry if the example is a bit
choppy.. it's tough to explain without seeing the table. In the
example below, I want to get rid of ID #'s - 01, 02, 03, 04, 08, 09.

ID SubmitterID LastName FirstName DateOfBirth ClaimID DiagCode
01 999999 Smith John 021280 11111 2222
02 999999 Smith John 021280 11111
03 999999 Smith John 021280 11111
04 999999 Smith John 021280 11111
05 444444 Jones Indiana 052768 55555 7777
06 333333 Brick Joe 093070 88888
07 333333 Brick Joe 093070 88888
08 666666 Lane Cathy 012355 44444 2222
09 666666 Lane Cathy 012355 44444

If anyone could help, that would be great!!!!!
Or if anyone needs me to clarify something, please let me know.

Thanks again!!!!!!!!!!
 
L

Lynn Trapp

Delete *
From YourTable
Where SubmitterID In (Select SubmitterID
From YourTable
Where ClaimID = 2222);
 

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