Hi,
I was able to cut down execution time to 20sec by replacing the
DATEADD(hour,-1,temp1.Timestamp)= temp2.Timestamp
to
ON temp1.RecordNumber-1= temp2.RecordNumber
for the JOINING condition
The Original SELECT statement was
SELECT DATE_ADD(temp1.Timestamp, INTERVAL...