楔子
学习时出现 1064错误。
出错sql
SELECT
ename,
sal,
hiredate
FROM
( SELECT ename, sal, hiredate, lead( sal ) over ( ORDER BY hiredate ) next_sal FROM emp )
WHERE
sal <> next_sal;
解决
子查询给定一个别名
SELECT
ename,
sal,
hiredate
FROM
( SELECT ename, sal, hiredate, lead( sal ) over ( ORDER BY hiredate ) next_sal FROM emp ) b
WHERE
sal < next_sal;