I'm not sure this is even possible but I know if it is, the stackoverflow community is where I'll find the answer. I'm basically trying to pre-process some data so that I can speed up my application. Here is an example of what I'm trying to do:
SELECT id
FROM data AS data1
WHERE rangeVal < (SELECT rangeVal FROM data WHERE id = data1.id - 1)
AND actiondate >= '1980-05-18'
AND actiondate <= '2012-05-18'
ORDER BY actiondate DESC
Essentially, I'm trying to get the IDs of my data only if their rangeVal is less than the rangeVal from the next day.
Any help or points in the right direction would be greatly appreciated!!
BETWEEN '1980-05-18' AND '2012-05-18', but engine should be good enough to do it for you. Did you test your query? What's wrong?