hql如下
select length(tag) from table1 order by length(tag) limit 20;
报错FAILED: SemanticException [Error 10004]: Line…Invalid table alias or column reference ‘tag’: (possible column names are: _c0)
FAILED: SemanticException [Error 10004]: Line…Invalid table alias or column reference ‘tag’: (possible column names are: _c0)
修改
用别名替代length(tag), 如下
select length(tag) as taglen from table1 order by taglen limit 20;
在order by中可以使用普通函数(如to_date()),但是不能使用聚合函数(如count(), sum())。
文章讨论了在HQL查询中遇到的错误,指出length(tag)作为列引用时需要改用别名taglen。同时提到在ORDERBY子句中只能使用普通函数如to_date(),不能使用聚合函数如count()和sum()。
5188

被折叠的 条评论
为什么被折叠?



