Welcome to SPN

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

Sign Up Now!

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.
    >
    >
    >
    >
     

Share This Page