stytax_error:第1:1:未在位置1指定的列名称
我正在尝试将以下查询返回表中,但是我会收到此错误
stytax_error:第1:1:未在位置1
上指定的列名。
但是每当我只选择它
SELECT replace(Pharma.Parent_Company, '"', '')
FROM Pharma
没有错误的时候
CREATE TABLE PHARMA_NEW AS SELECT replace(Pharma.Parent_Company, '"', '')
FROM Pharma
I am trying to return the below query into a table but I get this error
SYNTAX_ERROR: line 1:1: Column name not specified at position 1
.
But whenever I just select it like
SELECT replace(Pharma.Parent_Company, '"', '')
FROM Pharma
It doesnt have error
CREATE TABLE PHARMA_NEW AS SELECT replace(Pharma.Parent_Company, '"', '')
FROM Pharma
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如错误消息所说,您尚未指定该列的名称,而只有用于创建它的表达式。在某些情况下,没关系,您只需获得一个没有名称或生成名称的结果列,但是在此上下文中,Athena希望您自己选择名称。
因此,更改
替换(pharma.parent_company,'“','')
repleast(pharma.parent_company,'“'''''')为whyther_column_name_you_want 。As the error message says, you haven't specified a name for the column, only the expression used to create it. In some contexts, that's OK and you'll just get a result column with no name or a generated name, but in this context Athena wants you to choose the name yourself.
So change
replace(Pharma.Parent_Company, '"', '')
toreplace(Pharma.Parent_Company, '"', '') AS whatever_column_name_you_want
.