Search code examples
sqlsql-serverdate

SQL Date within range to give result


I'm looking to get a code that'll help me get a result from a date range based on a date.

Table A D.O.B

1994-04-12
1996-12-06
2009-11-22

Table B DATE RANGE COLUMN

Start cut off
1990-01-01 1999-12-31
2000-01-01 2009-12-31

SO... i want to get date from table A and match it with table B if it is between Start and cut off ?

I've tried multiple different ways and they don't work.


Solution

  • WHERE A.DOB BETWEEN B.STARTDATE AND B.CUTOFFDATE