Sample Header Ad - 728x90

Calculate Percentage with JOINS and original value

0 votes
1 answer
841 views
I need your help. I'm trying to calculate percentages by using results from JOINING divided by the original value. I do not know how to combine both values. I try to find trips with station id which do not exist in the table station and then find the percentage of that trips. I only can write the query to this extend: SELECT COUNT(*) FROM (SELECT a.start_station_id, b.station_id, a.end_station_id,a.bikeid FROM bigquery-public-data.new_york_citibike.citibike_trips as a LEFT OUTER JOIN bigquery-public-data.new_york_citibike.citibike_stations as b ON a.start_station_id = b.station_id WHERE b.station_id IS NULL) I need to divide the result COUNT from the query above with COUNT(*) before JOIN. Kindly help me with this. Thank you!!
Asked by snsd94 (1 rep)
Feb 3, 2021, 04:23 PM
Last activity: Dec 19, 2021, 04:07 PM