我想过滤用户表中每个性别的最高人,这是可以正常工作的代码:
SELECT s1.name, s1.sex, s1.height
FROM user s1
LEFT JOIN user s2 ON s1.sex =s2.sex AND s1.height < s2.height
WHERE s2.name IS NULL;
但这一个不起作用:
SELECT s1.name, s1.sex, s1.height
FROM user s1
LEFT JOIN user s2 ON s1.sex =s2.sex AND s1.height < s2.height AND s2.name IS NULL;
这是否意味着“is null”只能在“where”子句之后使用?