我有这个 MySQL 问题。它工作正常,但速度极慢。运行最多需要 30 秒。
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
)
如果我只运行子查询 ( SELECT Max(Id) FROM comments GROUP BY Tipid
),运行大约需要 0.02 秒。
子查询有问题。你有什么想法?