-2
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, usertype
ORDER BY num_trips DESC LIMIT 10

This part of the query was underlined as a SYNTAX error on the big query (start_station_name,) I copied it the exact way my instructor did on a course. But it didn't return a result.

oguz ismail
  • 1
  • 16
  • 47
  • 69
dejite
  • 1

1 Answers1

1

fixed the query for you:

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

there was a missing comma after usertype. there was missing parenthesis after int64. the group by had the wrong column names.

query runs and produces results.

Tom Elias
  • 751
  • 6
  • 15