Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

Delete Duplicates

Discussion in 'Information Technology' started by Vicki, Jul 28, 2006.

  1. Vicki

    Vicki
    Expand Collapse
    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.
     
  2. Loading...


  3. Phillip Windell

    Phillip Windell
    Expand Collapse
    Guest

    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.

    --
    Phillip Windell [MCP, MVP, CCNA]
    www.wandtv.com

    "Vicki" <Vicki@discussions.microsoft.com> wrote in message
    news:3A317521-7F8C-4465-A2BB-630DDDA76A0C@microsoft.com...
    > 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.
    >
    >
    >
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page