我有以下查询产生一些我想要排名的数字,这是查询。
SELECT a.id, a.name,
round((((select cast(count(mentions.id) as decimal)
from mentions, events
where mentions.event_id = events.id AND
events."startDate" < (to_date('2017-01-01', 'YYYY-MM-DD') -180) AND
mentions.person_id = a.id)
/
(select cast(count(mentions.id) as decimal)
from mentions, events
where mentions.event_id = events.id AND
events."startDate" < (to_date('2017-01-01', 'YYYY-MM-DD') -180) AND
mentions.person_id = 79)) * 100), 1) as lagged_person
FROM events, people, mentions
WHERE
events.id = mentions.event_id
GROUP BY a.id
ORDER BY a.name
基本上我需要做一些像RANK()OVER(lagged_person)这样的事情,当我把它作为我的下一个&#34;列&#34;在滞后的人之后,我得到一个错误,表示滞后的人不存在。我错过了什么?