SQL select maximum from two time periods
- by HamishC
I have a query, Im trying to select the maximum value from the summer period (nov-april down here) but it only gives me values from nov-dec with this query. Any ideas why?
SELECT TOP 10 Value, DateTime
FROM history
WHERE Tagname = @Tag
AND
((DateTime >= @StartYear AND DateTime < @StartWinter)
OR
(DateTime >= @FinishWinter AND DateTime < @FinishYear))
ORDER BY Value DESC