Reputation: 57
I am very new to Hive, so have a very basic question. In a Hive, can a sub query be given an alias and used outside in main query?
Basically when I try:
(SELECT *,
row_number() over(PARTITION BY ID, source_name
ORDER BY TIME DESC) rn
FROM x_table) temp_name
I get the following error:
AnalysisException: syntax error in line 1: undefined: .....)) temp_name^ Encountered: Identifier expected limit,order,union caused by : Exception :Syntax error
Upvotes: 0
Views: 1313
Reputation: 1936
Try this..
Select
*
from
(select
*
,row_number() over(partition by ID,source_name order by time desc) rn
from x_table
) t;
Upvotes: 1