Currently working with
DECLARE @yr AS int;
SET @yr = 2015;
which is used in
WHERE (YEAR(EndDate) = @yr)
AND (MONTH(EndDate) = 6)
AND (DAY(EndDate) = 30)
The result is correct when working with year by year (when I change it to 2016) but not for a range, which is the below.
When I change it to the following I do not get the same results. I can't figure out why.
I need the result to show the correct data in a range as it shows for individual year.
DECLARE @yr AS date; SET @yr = dbo.DateSerial(YEAR(GETDATE()), 6, 30); *<--- note: I have a Function and this is verified and works in a simple query, just apparently not in this*
WHERE (p.EndDate >= @yr)
Also, would prefer to not DECLARE