gpt4 book ai didi

sql - 为什么Count函数在此子查询上不起作用?

转载 作者:行者123 更新时间:2023-12-02 09:46:33 29 4
gpt4 key购买 nike

这个:

输出如下:

现在,我想对上面的表应用计数功能,为此我执行了以下查询。

select count(date1) from (
select date1 from tmp where
current_date > date1
);
并得到此错误:

Error code 20000, SQL state 42X01: Syntax error: Encountered ""at line 4, column 1.


注意:我正在使用Java DB

最佳答案

子查询通常需要一个别名,尝试

 select count(date1) from (
select date1 from tmp where
current_date > date1
) a ;

关于sql - 为什么Count函数在此子查询上不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30542346/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com