I would be very grateful for a bit of assistance with optimising a query. The code is as follows:
CREATE TABLE table_name (
FROM table1 AS T1,
(SELECT column1, column2, COUNT(column1) AS cnt
GROUP BY column1
) AS T2
WHERE T1.column1 = T2.column1
AND T1.column2 = T2.column2
ORDER BY T1.column1
The query runs but times out even though column1 and column2 are both index columns.
Any suggestions would be most helpful.
Thanks in advance.