Delete Duplicates

G

Guest

I have a table where I need to exclude certain records in a query or macro.
I only want to keep records for each PatID that have events within a day.
And yet I need to keep one record where a PatID has all Null values within a
day. Here are some examples:

Example #1: I need to keep the two records that have 'PB' and 'PB' events
and eliminate the null value. Events takes precedence for a PatID within the
same day over the null records.
PatID Date ReqNo SeqNo Event
26409 6/6/06 10:51 AM [NULL] [NULL]
26409 6/6/06 1:23 PM 6996234 1 pb
26409 6/6/06 1:23 PM 6996234 1 pl

Example #2: Since this PatID has all Null values within the day, I only
need to keep one. I could keep the max date (but it doesn't really matter).
6438375 6/6/06 7:17 PM [NULL] [NULL] [NULL]
6438375 6/6/06 7:28 PM [NULL] [NULL] [NULL]
6438375 6/6/06 7:57 PM [NULL] [NULL] [NULL]
6438375 6/6/06 9:59 PM [NULL] [NULL] [NULL]
6438375 6/6/06 9:59 PM [NULL] [NULL] [NULL]
6438375 6/6/06 10:53 PM [NULL] [NULL] [NULL]

So I need to write a query or macro that can do this for me and I am not
sure how I can accomplish that. So I need to focus on a unique PatID by each
day in my logic. Help!!

I will then use this query in a report.
 
P

Phillip Windell

You haven't gotten an answer yet because, I suspect, that no one understands
your Table Structure (or if it was even done properly) and that is critical
to know to be able to design a query. Even in a perfect world what you are
asking is very complicated and you may need to re-think what it is you
really need and how you need it.
 

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