吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1651|回复: 18
收起左侧

[求助] 数据库SQL报错

[复制链接]
yyKin 发表于 2022-3-20 15:23
Exception in thread "main" org.apache.spark.sql.catalyst.parser.ParseException:
mismatched input 'from' expecting {<EOF>, 'WHERE', 'GROUP', 'ORDER', 'HAVING', 'LIMIT', 'LATERAL', 'WINDOW', 'UNION', 'EXCEPT', 'MINUS', 'INTERSECT', 'SORT', 'CLUSTER', 'DISTRIBUTE'}(line 5, pos 0)

sql语句:
select
`CUSTKEY`,
COUNT(distinct(`CUSTKEY`)) count
from
^^^
     (SELECT
       `CUSTKEY`,
       `event_date`,
       lag(event_date,1,"1997-01-01") over(distribute by `CUSTKEY` sort by `event_date`) lag_1,
       lead(event_date,1,"1999-99-99") over(distribute by `CUSTKEY` sort by `event_date`) lead_1
    from
       (select
           `CUSTKEY`,
           to_date(`ORDERDATE`) event_date
          FROM
           ods.ORDERS)t1)t2
WHERE
((moth(lag_1)-moth(event_data)) >1 )
or
((moth(event_data)-moth(lead_1) >1)
GROUP BY `CUSTKEY`

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

vr4u 发表于 2022-3-20 16:27
一般个人看不懂
独立电影人 发表于 2022-3-20 16:34
 楼主| yyKin 发表于 2022-3-20 16:40
神幻静 发表于 2022-3-20 17:30
目测是少括号了
Pandolar 发表于 2022-3-20 18:07
这是什么SQL   mysql吗? 还是hql
Pandolar 发表于 2022-3-20 18:09
你用with as 吧 别直接接在form后面
hu1240265831 发表于 2022-3-20 18:09
你什么数据库,不同的数据库 日期的写法不一样
小熙家的大厨 发表于 2022-3-20 18:23
坐等大佬解答
s1986q 发表于 2022-3-20 19:49
from 是 form
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-6-11 04:43

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表