输出如下:
现在我想在上面的表格申请计数功能,对于我执行下面的查询。
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
);
而得到这个错误:
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 ;
我不知道JavaDB之外,但要尽量让你的嵌套查询语句的别名:
从(选择date1 from tmp where current_date> date1)选择count(*)cnt a
尝试使用count(*) –
@JoaozitoPolo仍然得到同样的错误 – user4913383