select (
SELECT SUM(countNumber) from(
SELECT FROM_UNIXTIME(unix_timestamp(AddTime),'yyyy-MM-dd') AS dateTime,
COUNT(productID) AS countNumber
FROM product
GROUP BY FROM_UNIXTIME(unix_timestamp(AddTime),'yyyy-MM-dd')
) as bb
where aa.dateTime >= bb.dateTime
) as totalCount,
aa.countNumber,
aa.dateTimefrom (
SELECT FROM_UNIXTIME(unix_timestamp(AddTime),'yyyy-MM-dd')AS dateTime,
COUNT(productID) AS countNumber
FROM product
GROUP BY FROM_UNIXTIME(unix_timestamp(AddTime),'yyyy-MM-dd')
) aa order by dateTime desc limit 10000;
我不想查询每日累计数量。为什么这个hql不能工作?配置单元引擎提示:
FAILED: ParseException line 2:8 cannot recognize input near 'SELECT' 'SUM' '(' in expression specification
1条答案
按热度按时间dfty9e191#
配置单元中不允许子查询作为列。要获取累计数量,请使用window函数
sum
.