Help With Query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BerkshireGuy

    #1

    Help With Query

    Hello everyone,

    I have the follow data set:

    Policy Number Status Date
    --------------------------------
    123 Approved 11/15/2004
    123 Received 10/12/2004
    123 Paid 1/1/2005
    124 Approved 1/5/2005
    124 Paid 1/24/2005
    124 Received 11/15/2005
    125 Received 01/12/2005
    125 Approved 01/13/2005
    125 Paid 01/24/2005

    As you can see, a policy can have multiple records each having a
    different status (Received, Approved, Paid, etc)

    I need to cycle through these policies and check the following
    criteria.

    I need to return the Policies that:

    1) All status occurred in 2005 (Paid,Received, Approved)
    2) Received record occurred in 2004 but other status happened in 2005
    3) Approved record did not occur in 2004

    Can this be done in one query? Note that in #3 that if the Approved
    record occurred in 2004 - I want to omit that policy all together, not
    just the Approved record.

    Thanks.

Working...