Hiveql subquery is not working.

Why this subquery hiveql not work?

SELECT(
SELECT SUM(cnum) from(
SELECT FROM_UNIXTIME(unix_timestamp(Addtime),'yyyy-MM-dd') AS d_time,
COUNT(material_id) AS cnum
FROM material
GROUP BY FROM_UNIXTIME(unix_timestamp(AddTime),'yyyy-MM-dd')
) as abc
where aa.d_time >= abc.d_time
) as totalCount,
xyz.cnum,
xzy.d_time from (
SELECT FROM_UNIXTIME(unix_timestamp(AddTime),'yyyy-MM-dd')AS d_time,
COUNT(material_id) AS cnum
FROM material
GROUP BY FROM_UNIXTIME(unix_timestamp(AddTime),'yyyy-MM-dd')
) xyz order by d_time desc limit 1100;

I want to query daily cumulative quantity but this query does not work? Error :
FAILED: ParseException line 2:8 cannot recognize input near 'SELECT' 'SUM' '(' in expression specification.

Tagged:
Sign In or Register to comment.