select
supplier,module,pline,station,date,avg(detail.valuedouble)
from
`sqm`.`sqm_value_quality_detail` detail ,
`sqm`.`sqm_station_performance_view` station
where detail.valuetype='double' and detail.value_station_id = station.guid
group by supplier,module,pline,station,date