I am stumped on trying to write a query that will accomplish my desired output.
What I have is two tables, the first contains an account number (and other specific details), the second contains a record of statements recieved. There should always be one statement recieved each year. I am wanting an output to show me which accounts have NOT recieved a statement and for which year.
Here is data in table 1:
AcctNo Active FirstYr
139 1 2001
214 1 2003
536 1 2004
758 1 2000
Here is data in Table 2:
AcctNo Year RecvDate
214 2003 1/12/2004
214 2004 1/2/2005
536 2004 12/20/2003
758 2004 1/3/2005
Desired Output:
AcctNo Year RecvDate
139 2003 NULL
139 2004 NULL
214 2003 1/12/2004
214 2004 1/2/2005
536 2004 12/20/2003
758 2003 NULL
758 2004 1/3/2004
From that I can then generate my report that show which accounts have not recieved a statement based on plan year.
I am sure I just missing something simple, or trying to do to much with a single query.
Can someone help or at least point me in the right direction.
Thanks.
Persistence....Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent. -Calvin Coolidge
What I have is two tables, the first contains an account number (and other specific details), the second contains a record of statements recieved. There should always be one statement recieved each year. I am wanting an output to show me which accounts have NOT recieved a statement and for which year.
Here is data in table 1:
AcctNo Active FirstYr
139 1 2001
214 1 2003
536 1 2004
758 1 2000
Here is data in Table 2:
AcctNo Year RecvDate
214 2003 1/12/2004
214 2004 1/2/2005
536 2004 12/20/2003
758 2004 1/3/2005
Desired Output:
AcctNo Year RecvDate
139 2003 NULL
139 2004 NULL
214 2003 1/12/2004
214 2004 1/2/2005
536 2004 12/20/2003
758 2003 NULL
758 2004 1/3/2004
From that I can then generate my report that show which accounts have not recieved a statement based on plan year.
I am sure I just missing something simple, or trying to do to much with a single query.
Can someone help or at least point me in the right direction.
Thanks.
Persistence....Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent. -Calvin Coolidge