创建了以geosalary
列name
、id
和命名的表salary
:
name id salary
patrik 2 1000
frank 2 2000
chinmon 3 1300
paddy 3 1700
我尝试了下面的代码来找到第二高的薪水:
SELECT salary
FROM (SELECT salary, DENSE_RANK() OVER(ORDER BY SALARY) AS DENSE_RANK FROM geosalary)
WHERE DENSE_RANK = 2;
但是,收到此错误消息:
ERROR: subquery in FROM must have an alias
SQL state: 42601
Hint: For example, FROM (SELECT ...) [AS] foo.
Character: 24
我的代码有什么问题?