I have this MySQL question. It works fine, but it’s extremly slow. It takes up to 30 seconds to run.
SELECT t.Id, Subject, k.info
FROM tip t
LEFT JOIN comments k ON t.Id = k.Tipid
WHERE event = 1
AND k.Id
IN (
SELECT Max(Id) FROM comments GROUP BY Tipid
)
If I run only the subquery (SELECT Max(Id) FROM comments GROUP BY Tipid) it takes about 0.02 seconds to run.
Something is wrong with the subquery. Do you have any ideas?
you dont need group by if you select max(id) try this