two user parameteres in @StartDate and @EndDate
two parameters to store min and max date in the table @MinDate and @MaxDate
select the min and max date from the table
SELECT @MinDate = MIN(DATE), @MaxDate = MAX(DATE) FROM table
IF @StartDate >= @MinDate AND @EndDate <= @MaxDate
BEGIN
SELECT
.....
FROM
.....
JOIN
....
WHERE
Date >= @StartDate AND Date <=@EndDate
END