首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ParseException: SQL

ParseException: SQL
EN

Stack Overflow用户
提问于 2022-04-07 04:03:40
回答 1查看 202关注 0票数 1
代码语言:javascript
复制
result = aml_identity_g.connectedComponents()
conn_comps = result.select("id", "component",'type') \
  .createOrReplaceTempView("components") 
display(result)

这创造了

代码语言:javascript
复制
%sql
create table temptable 
as with dupes as (
   select component, count(case when type = 'Person' then 1 end) person_ct 
   from components 
   group by component 
   having person_ct > 1
)

将我抛出一个错误

代码语言:javascript
复制
Error in SQL statement: ParseException: 
mismatched input '<EOF>' expecting {'(', 'DESC', 'DESCRIBE', 'FROM', 'MAP', 'REDUCE', 'SELECT', 'TABLE', 'VALUES'}(line 6, pos 21)
   
== SQL ==
create table temptable 
as with dupes as (
    select component, count(case when type = 'Person' then 1 end) 
person_ct 
    from components 
    group by component 
    having person_ct > 1
)
---------------------^^^

不明白这里的错误。

EN

回答 1

Stack Overflow用户

发布于 2022-04-24 12:05:55

在这个查询中,您真的不需要CTE --应该足够有正常的SELECT了。所以应该是这样的:

代码语言:javascript
复制
create table temptable as (
   select component, count(case when type = 'Person' then 1 end) person_ct 
   from components 
   group by component 
   having person_ct > 1
)

根据关于拥有条款的文件,您可以在HAVING表达式中使用别名。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71776197

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档