可能重复:
JOIN 或 WHERE 中的条件
以下 2 个查询是否相同?
SELECT u.*
FROM User u
INNER JOIN Sales s ON (u.userId = s.userId)
WHERE
u.active = 1 AND
s.amount > 0 AND
s.status = 1
相对:
SELECT u.*
FROM User u
INNER JOIN Sales s ON
(u.userId = s.userId AND s.amount > 0 and s.status=1)
WHERE
u.active = 1
这两个查询在结果集方面总是相同的吗?性能考虑?