Query Optimisation, Is there is any other way to change this query. it takes some time to return result?
SELECT count(pagerno) as new
FROM tbldetails s1
WHERE s1.ccode = ‘$StrCode’
AND s1.col1 <> ‘invalid’
AND s1.col5 = ‘0’
AND s1.col6 <=‘$strDte’
AND s1.col6=(select MAX(s2.col6) FROM tbldetails s2
WHERE s1.pagerno = s2.pagerno AND s2.ccode = ‘$StrCode’
AND s2.col1 <> ‘invalid’ AND s1.col5 = ‘0’ AND s2.col6 <=‘$strDte’