I have query results from a table, based on ID = '27489':
ID Stmt Date Stmt Yr Method
27489 2003-12-31 2003 Reviewed
27489 2004-12-31 2004 Reviewed
27489 2005-12-31 2005 Co.Prep'd
27489 2005-12-31 2005 Unqualified
27489 2005-12-31 2005 Reviewed
My results need to be more narrow, selecting 2 years most recent statments. However, If one Stmt Date has multiple records (i.e. like 2005-12-31 in the above table), I need to pick the Stmt based on column "Method", based on the following hierarchy:
a. Unqualified
b. Qualified
c. Reviewed
d. Compiled
e. Company Prepared
f. Tax Return
Example: If there are three spreads for the same Stmt Date(like the table above), the one spread that has Audit Method of “Unqualified” would be selected for 2005-12-31 based on the hierarchy.
What I need for final results are the 2 most recent statments based on Stmt Date, like this:
27489 2005-12-31 2005 Unqualified
27489 2004-12-31 2004 Reviewed
I'm struggling with how to evaluate the stmt dates that have multiple methods. Any suggestions?
Regards,
Joe
ID Stmt Date Stmt Yr Method
27489 2003-12-31 2003 Reviewed
27489 2004-12-31 2004 Reviewed
27489 2005-12-31 2005 Co.Prep'd
27489 2005-12-31 2005 Unqualified
27489 2005-12-31 2005 Reviewed
My results need to be more narrow, selecting 2 years most recent statments. However, If one Stmt Date has multiple records (i.e. like 2005-12-31 in the above table), I need to pick the Stmt based on column "Method", based on the following hierarchy:
a. Unqualified
b. Qualified
c. Reviewed
d. Compiled
e. Company Prepared
f. Tax Return
Example: If there are three spreads for the same Stmt Date(like the table above), the one spread that has Audit Method of “Unqualified” would be selected for 2005-12-31 based on the hierarchy.
What I need for final results are the 2 most recent statments based on Stmt Date, like this:
27489 2005-12-31 2005 Unqualified
27489 2004-12-31 2004 Reviewed
I'm struggling with how to evaluate the stmt dates that have multiple methods. Any suggestions?
Regards,
Joe