[英]Select AS not working in interbase
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 将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
You can only use column aliases in GROUP BY, ORDER BY, or HAVING clauses. 您只能在GROUP BY,ORDER BY或HAVING子句中使用列别名。
Standard SQL doesn't allow you to refer to a column alias in a WHERE clause. 标准SQL不允许您引用WHERE子句中的列别名。 This restriction is imposed because when the WHERE code is executed, the column value may not yet be determined. 施加此限制是因为当执行WHERE代码时,可能尚未确定列值。
Try this 尝试这个
select payeeid, EXTRACT(WEEKDAY FROM checkdate) as DOW,
(bankcleared - checkdate) as DateDiff
from Master
where (bankcleared is not null) AND ((bankcleared - checkdate)>= 1)
order by payeeid, DOW, DateDiff
For more info go through these links 有关更多信息,请浏览这些链接
Can you use an alias in the WHERE clause in mysql? 你能在mysql的WHERE子句中使用别名吗?
select payeeid,
EXTRACT(WEEKDAY FROM checkdate) as DOW,
(bankcleared - checkdate) as DateDiff
from Master
WHERE (bankcleared is not null)
AND ((bankcleared - checkdate)>= 1)
Order by payeeid, DOW, DateDiff
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.