Code: Select all
select Pot, count(*) value
from Pots
WHERE Pot BETWEEN :PotFrom AND :PotTo
and Dt >= ( :Date -10 )
and Dt < (:Date + 1)
Group by Pot
If I change ":Date" to something else, ":Dat" everything is fine.
The problem is probably the fact the "Date" is a reserved word, but in this case, only as a parameter.
And yes (long explanation, but) simply changing to ":Dat" will take (almost) forever.