sql - 任何 SQL 专家都可以检查我的 SQL 查询吗,它没有用
问题描述
SELECT
usertype,
CONCAT(start_station_name, " to", end_station_name) AS route
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_trip desc
LIMIT 100
解决方案
I was just going to post this as a comment, but wanted to offer some formatting advice too
SELECT
usertype,
CONCAT(start_station_name, " to", end_station_name) AS route,
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_trip DESC
LIMIT 100
I think your issue was just the missing commas in the SELECT
and GROUP BY
sections, but I also recommend capitalizing all syntax and separating lists by indented new lines -- these things help spot errors
推荐阅读
- angular - Angular 2 在两个组件之间获取数据
- bash - 列出所有包含 string1 的唯一目录,其中包含包含 string2 的文件
- html - 第一个孩子的概念不适合我?
- java - 使用 BufferedReader / BufferedWriter 的套接字连接
- javascript - 添加实际内容时代码功能中断?
- python - 停止一段时间循环从另一个 python 程序修改其条件(标志)
- javascript - 单击开始按钮时的 JavaScript 倒数计时器,用于小时、分钟和秒
- typo3 - Typo3:登录后重定向不起作用
- laravel - 在 Laravel 中使用一组硬编码的值代替传统的 Eloquent 模型
- angular - ng测试期间的StaticInjectorError