我尝试使用mysql版本8.0.12引导一个列,代码返回一个错误。有人能帮我吗?
这是我的sql配置
mysql Ver 8.0.12 for osx10.14 on x86_64 (Homebrew)
我有这个数据集:
member_id date
0 A 2013-03-29 13:11:19
1 B 2013-03-29 13:52:41
2 C 2013-03-29 18:46:12
3 D 2013-03-30 06:21:50
4 D 2013-03-30 06:22:13
5 D 2013-03-30 06:22:21
6 D 2013-03-30 06:30:51
7 E 2015-04-30 07:05:53
8 F 2015-04-30 16:45:57
9 G 2015-04-30 17:15:14
我想得到这个
member_id date. date_led
0 A 2013-03-29 13:11:19. NULL
1 B 2013-03-29 13:52:41. NULL
2 C 2013-03-29 18:46:12. NULL
3 D 2013-03-30 06:21:50. 2013-03-30 06:22:13
4 D 2013-03-30 06:22:13. 2013-03-30 06:22:21
5 D 2013-03-30 06:22:21. 2013-03-30 06:30:51
6 D 2013-03-30 06:30:51. NULL
7 E 2015-04-30 07:05:53. NULL
8 F 2015-04-30 16:45:57. NULL
9 G 2015-04-30 17:15:14 NULL
所以我用python做了这个请求
connection = pymysql.connect(host='IP',
user='NAME',
password='PASS',
db='DB',
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor
)
request = """ SELECT member_id, date,
LEAD(date,1) OVER (PARTITION BY member_id ORDER BY date) nextOrderDate
FROM action_log
"""
pd.read_sql(request, connection)
我有个错误信息
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(PARTITION BY member_id ORDER BY date ) nextOrderDate FROM action_log' at line 1
我做错什么了?
谢谢
1条答案
按热度按时间velaa5lx1#
这是由于chart.io和windows函数造成的。