I’ve developed a query that produces a list of forms and an effective date where the form may be applicable. But now I am stumped. I need to reduce the results to a specific state (which I’ve done and it works) and for a specific date (the stumped part). Let’s say user needs 2/15/2005. I think I can eliminate forms with effective dates greater than 2/15/2005 (not quite sure how yet) but I am perplexed how to eliminate certain forms that are no longer valid because they’ve been superceded. In the sample table for CA, I would expect the following forms retuned and no others: CG0001 1204; CG0002 1204; CG0009 1204; CG0033 10 01; CG0034 1204; and CG0035 1207. The expected results for the CT column would be different (though some would be the same).
Any advice to point me in the right direction would be appreciated.
FormNum Form_vdt CA CT
CG0001 0798 09/01/1999
CG0001 1001 03/26/2001 02/01/2002
CG0001 1204 07/13/2004 07/01/2005
CG0001 1207 12/05/2007 12/01/2007
CG0002 1001 03/26/2001 02/01/2002
CG0002 1204 07/13/2004 07/01/2005
CG0002 1207 12/05/2007 12/01/2007
CG0009 1001 03/26/2001 02/01/2002
CG0009 1204 07/13/2004 07/01/2005
CG0009 1207 12/05/2007 12/01/2007
CG0033 0196 03/26/2001 05/01/1996
CG0033 1001 07/13/2004 02/01/2002
CG0033 1204 12/05/2007 07/01/2005
CG0033 1207 12/07/2007 12/01/2007
CG0034 1001 03/26/2001 02/01/2002
CG0034 1204 07/13/2004 07/01/2005
CG0035 1001 12/05/2007 02/01/2002
CG0035 1204 03/26/2001 07/01/2005
CG0035 1207 07/13/2004 12/01/2007
Any advice to point me in the right direction would be appreciated.
FormNum Form_vdt CA CT
CG0001 0798 09/01/1999
CG0001 1001 03/26/2001 02/01/2002
CG0001 1204 07/13/2004 07/01/2005
CG0001 1207 12/05/2007 12/01/2007
CG0002 1001 03/26/2001 02/01/2002
CG0002 1204 07/13/2004 07/01/2005
CG0002 1207 12/05/2007 12/01/2007
CG0009 1001 03/26/2001 02/01/2002
CG0009 1204 07/13/2004 07/01/2005
CG0009 1207 12/05/2007 12/01/2007
CG0033 0196 03/26/2001 05/01/1996
CG0033 1001 07/13/2004 02/01/2002
CG0033 1204 12/05/2007 07/01/2005
CG0033 1207 12/07/2007 12/01/2007
CG0034 1001 03/26/2001 02/01/2002
CG0034 1204 07/13/2004 07/01/2005
CG0035 1001 12/05/2007 02/01/2002
CG0035 1204 03/26/2001 07/01/2005
CG0035 1207 07/13/2004 12/01/2007