Hi All,
I am trying to compare ADate to see if it falls between startdate and enddate for same Name and code combination and get the result:
E.g: The table i have is
Name Code Adate StartDate EndDate A1 10 1/20/2010 1/20/2010 1/20/2010 A1 10 3/3/2010 1/20/2010 1/20/2010 A1 20 1/26/2010 1/26/2010 1/26/2010 A1 20 1/26/2010 2/22/2010 2/23/2010 A1 20 1/26/2010 3/18/2010 3/18/2010 A1 20 2/22/2010 1/26/2010 1/26/2010 A1 20 2/22/2010 2/22/2010 2/23/2010 A1 20 2/22/2010 3/18/2010 3/18/2010 A1 20 2/23/2010 1/26/2010 1/26/2010 B1 20 2/23/2010 2/22/2010 2/23/2010 B1 20 2/23/2010 3/18/2010 3/18/2010
I am trying to write query to get :
Name Code Adate Result A1 10 1/20/2010 Yes A1 10 3/3/2010 No A1 20 1/26/2010 Yes A1 20 2/22/2010 Yes A1 20 2/23/2010 Yes B1 20 2/23/2010 Yes
A1 10 is No because there are no date ranges matching for this combination. Please let me know if there is an efficient way of getting the result. Thanks.