WHERE中AS后如何使用关键字
How to use the keyword after AS in WHERE
我正在计算会员注册的总年份。
我需要 return 结果有多少会员注册超过 5 年,但我在 运行 代码时遇到错误。
第 3 行显示 "duration" 无效标识符
select floor(months_between(SYSDATE,RegistrationDate)/12) as "Duration"
from member
where duration > 5;
您可以使用子查询:
select *
from
(
select floor(months_between(SYSDATE,RegistrationDate)/12) as "Duration"
from member
)
where "Duration" > 5;
我正在计算会员注册的总年份。 我需要 return 结果有多少会员注册超过 5 年,但我在 运行 代码时遇到错误。
第 3 行显示 "duration" 无效标识符
select floor(months_between(SYSDATE,RegistrationDate)/12) as "Duration"
from member
where duration > 5;
您可以使用子查询:
select *
from
(
select floor(months_between(SYSDATE,RegistrationDate)/12) as "Duration"
from member
)
where "Duration" > 5;