Bug1- SQL报错信息-line 8:19 cannot recognize input near ‘<EOF>‘ ‘<EOF>‘ ‘<EOF>‘ in subquery source

中文释义:第8行:19无法识别子查询源中“”“”“附近的输入

延申知识点:EOF(End of File),通常在文本的最后存在此字符表示资料结束。

错误原因:未给子表加别名

错误SQL:

select product
from(
select product,
       ym,
       amount,
       first_value(amount) over (partition by product order by amount) as first_value,
       row_number() over (partition by product order by amount) as num
from sales_monthly);

修改后:

select product
from(
select product,
       ym,
       amount,
       first_value(amount) over (partition by product order by amount) as first_value,
       row_number() over (partition by product order by amount) as num
from sales_monthly) as t1;

你可能感兴趣的:(Bug,sql,数据库,hive)