本文介绍: 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

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())。

原文地址:https://blog.csdn.net/AnillegalName/article/details/135653290

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。

如若转载,请注明出处:http://www.7code.cn/show_59918.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注