hive中使用order by时发现的小问题:Line 3:9 Invalid table alias or column reference ‘history

hive中使用order by时发现的小问题:Line 3:9 Invalid table alias or column reference ‘history,第1张

hive中使用order by时发现的小问题:Line 3:9 Invalid table alias or column reference ‘history

执行的sql:

select learning_position_id,learning_path_id
from position_course_sort
order by history_sort,recommend_sort,hot_sort

报错信息:

FAILED: SemanticException [Error 10004]: Line 3:9 Invalid table alias or column reference 'history_sort': (possible column names are: learning_position_id, learning_path_id)

报错原因:
select 后面的字段必须包含order by后面的所有字段,不然就会报上面的错误

解决办法:
select 后除了加上需要查询的字段之外,还要再加上order by 后面跟的字段

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5664880.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存