I have a table that has fields GRP_CODE & END_DATE. For a given
GRP_CODE and a given month of a year, there may be 1, 2 or 3 END_DATE
values.
For Example,
GRP_CODE END_DATE
AA 07/14/2003
AA 07/28/2003
BB 07/14/2003
BB 07/28/2003
AA 08/01/2003
AA 08/15/2003
AA 08/29/2003
BB 08/01/2003
BB 08/15/2003
BB 08/29/2003
....
I have to develop a query that has one input parameter, a date. The
query should return either 0, 1, 2, or 3 based on the match with the
END_DATE field.
In the above example, here is what the query should return the
following results for various input dates
Input Date Query Output
08/01/2003 1
08/15/2003 2
08/29/2003 3
08/30/2003 0
07/14/2003 1
07/28/2003 2
Can anybody help me with how the query can be written?
Thanks in advance.
GRP_CODE and a given month of a year, there may be 1, 2 or 3 END_DATE
values.
For Example,
GRP_CODE END_DATE
AA 07/14/2003
AA 07/28/2003
BB 07/14/2003
BB 07/28/2003
AA 08/01/2003
AA 08/15/2003
AA 08/29/2003
BB 08/01/2003
BB 08/15/2003
BB 08/29/2003
....
I have to develop a query that has one input parameter, a date. The
query should return either 0, 1, 2, or 3 based on the match with the
END_DATE field.
In the above example, here is what the query should return the
following results for various input dates
Input Date Query Output
08/01/2003 1
08/15/2003 2
08/29/2003 3
08/30/2003 0
07/14/2003 1
07/28/2003 2
Can anybody help me with how the query can be written?
Thanks in advance.
Comment