Hi.
I have written a query which is super slow. Basically I have 2 tables;
tblResult;
Ref_ID (int)
Returned (tinytext)
tblInfo;
ID (int)
DateEntered (timestamp)
I need to get IDs (tblResult.Ref_ID and tblInfo.ID are comparible) where the Returned field isnt 'I' or 'U', and the date is between 2 set dates (entered by user).
I have thought up the following query;
SELECT tblResult.Ref_ID FROM tblResult, tblInfo WHERE tblResult.Returned ='U' OR tblResult.Returned ='I' AND tblResult.Ref_ID = tblInfo.ID AND UNIX_TIMESTAMP(tblInfo.DateEntered) BETWEEN '1142985600' AND '1143072000'
However it is super slow, the PHP script times out (it needs to run 2 similar queries).
Does anyone have any idea how I could speed it up!?
Thanks!!
K.