Hi - the following takes 7 secs to run (78 rows are returned) - any ideas how to speed it up?
Code:
SELECT action.userid
FROM `action`
LEFT JOIN
(SELECT
COUNT(
CASE
WHEN UCASE(response.reasonid) LIKE '%APPOINTMENT%' THEN 1
END
) AS appt, response.actionid
FROM
response
GROUP BY response.actionid) AS resp
ON resp.actionid = action.actionid
WHERE DATE(action.actiondate) BETWEEN '20121001' AND '20121031'
AND action.typeid = '1'
GROUP BY action.userid