I have a very long name for a table "bigquery-public-data.new_york.nypd_mv_collisions" union all and also I don't know where to put the name for the first select.I'm trying to create one row for each vehicle type and count each of them. I want to call the long table name c or something like that, but what is the right order?
I get an error: Unrecognized name: vehicle_type_code1 at [1:8]
select vehicle_type_code1, vehicle_type_code2, vehicle_type_code_3, vehicle_type_code_4,
vehicle_type_code_5,count(vehicle) as count_all
from
(
select vehicle_type_code1 as vehicle from bigquery-public-data.new_york.nypd_mv_collisions
union all
select vehicle_type_code2 as vehicle from bigquery-public-data.new_york.nypd_mv_collisions
union all
select vehicle_type_code_3 as vehicle from bigquery-public-data.new_york.nypd_mv_collisions
union all
select vehicle_type_code_4 as vehicle from bigquery-public-data.new_york.nypd_mv_collisions
union all
select vehicle_type_code_5 as vehicle from bigquery-public-data.new_york.nypd_mv_collisions
)c
Group by vehicle
order by dasc
limit 3;
how to fix it?
Thank you