选择 AS 在 interbase 中不工作
可以
select payeeid, EXTRACT(WEEKDAY FROM checkdate) as DOW,
(bankcleared - checkdate) as DateDiff
from Master
where (bankcleared is not null)
order by payeeid, DOW, DateDiff
将 DateDiff
添加到 Where
- 不起作用
select payeeid, EXTRACT(WEEKDAY FROM checkdate) as DOW,
(bankcleared - checkdate) as DateDiff
from Master
where (bankcleared is not null) AND (DateDiff >= 1)
order by payeeid, DOW, DateDiff
works
select payeeid, EXTRACT(WEEKDAY FROM checkdate) as DOW,
(bankcleared - checkdate) as DateDiff
from Master
where (bankcleared is not null)
order by payeeid, DOW, DateDiff
adding DateDiff
to Where
- does not work
select payeeid, EXTRACT(WEEKDAY FROM checkdate) as DOW,
(bankcleared - checkdate) as DateDiff
from Master
where (bankcleared is not null) AND (DateDiff >= 1)
order by payeeid, DOW, DateDiff
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只能在 GROUP BY、ORDER BY 或 HAVING 子句中使用列别名。
标准 SQL 不允许您在 WHERE 子句中引用列别名。施加此限制是因为当执行 WHERE 代码时,列值可能尚未确定。
试试这个
有关更多信息,请浏览这些链接
可以你在mysql的WHERE子句中使用了别名吗?
Where子句中的未知列
You can only use column aliases in GROUP BY, ORDER BY, or HAVING clauses.
Standard SQL doesn't allow you to refer to a column alias in a WHERE clause. This restriction is imposed because when the WHERE code is executed, the column value may not yet be determined.
Try this
For more info go through these links
Can you use an alias in the WHERE clause in mysql?
Unknown Column In Where Clause