select
val1.station_code, val1.fail,val2.totalfrom(select count(guid) fail ,station_code from `sqm`.`sqm_value_quality_station` WHERE result='PASS'GROUP BY station_code) val1left join (select count(guid) total,station_code from `sqm`.`sqm_value_quality_station` GROUP BY station_code) val2on val1.station_code = val2.station_code