【问题标题】:my query won't run, and I think the query is correct, anyone knows what I did wrong?我的查询不会运行,我认为查询是正确的,有人知道我做错了什么吗?
【发布时间】:2023-02-14 20:00:06
【问题描述】:
SELECT usertype CONCAT(start_station_name,"to", end_station_name) AS route, COUNT (*) AS num_trips, ROUND(AVG(cast(tripduration as int64/60),2) AS duration FROM bigquery-public-data.new_york_citibike.citibike_trips GROUP BY start_station, end_station, 用户类型ORDER BY num_trips DESC LIMIT 10
查询的这一部分被强调为大查询的语法错误(start_station_name,我按照我的讲师在课程中所做的方式复制了它,但它没有返回结果
【问题讨论】:
标签:
google-bigquery
group-concat
google-data
【解决方案1】:
为您修复了查询:
SELECT usertype, CONCAT(start_station_name ,"to", end_station_name) AS route, COUNT (*) AS num_trips, ROUND(AVG(cast(tripduration as int64)/60),2) AS duration FROM bigquery-public-data.new_york_citibike.citibike_trips GROUP BY start_station_name, end_station_name, usertype ORDER BY num_trips DESC LIMIT 10
用户类型后缺少逗号。 int64 后缺少括号。 group by 的列名错误。
查询运行并产生结果。