Home > Enterprise >  My WHERE clause is not showing when I put equal to a value
My WHERE clause is not showing when I put equal to a value

Time:08-10

So when I put this code everything works except for the end_station_name as it shows all end_station_name, not just "Toomey Rd @ South Lamar" how I want to. Why is that?

SELECT 
subscriber_type , duration_minutes , end_station_name, start_station_name
FROM 
bigquery-public-data.austin_bikeshare.bikeshare_trips
 WHERE (subscriber_type = "Walk Up") OR (subscriber_type = "24-Hour Kiosk (Austin B-cycle)") 
 AND end_station_name = "Toomey Rd @ South Lamar"
 ORDER BY duration_minutes DESC

CodePudding user response:

This is because the AND operator has precedence over OR. Can you try to put the first 2 conditions which use OR in a bracket

WHERE ( (subscriber_type = "Walk Up") OR (subscriber_type = "24-Hour Kiosk (Austin B-cycle)") )AND end_station_name = "Toomey Rd @ South Lamar"
  • Related