SELECT submissions.created_at, guests.accepted
FROM submission
INNER JOIN guests
ON guests.event_id = 1
ORDER BY submissions.created_at ASC;
当前,此查询需要很长时间才能运行(甚至可能不返回所有内容)。
我要完成的是:
获取字段submissions.created at和guests.accepted(这两个字段通过提交ID链接)
给定某个事件id(例如事件1)。
我的问题是什么?
最佳答案
您忘记在查询中提供联接条件。试试这个:
SELECT submissions.created_at, guests.accepted
FROM submission s
INNER JOIN guests g on g.event_id = s.submissions_id
where guests.event_id = 1
ORDER BY submissions.created_at ASC;
关于mysql - 低效查询,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25271500/