Mysql Join with sum and count grouped by without subquery -
my version of mysql doesn't allow me create views subqueries this
create or replace view v_auto select t_auto.id_auto, t_auto.id_marca, t_auto_marca.marca, ifnull(tsa.spese_tot, 0) spese_tot, ifnull(tpa.photo_count, 0) photo_count t_auto left outer join ( select id_auto, sum(importo) spese_tot t_spese_auto group id_auto ) tsa on (t_auto.id_auto = tsa.id_auto) left outer join ( select id_auto, count(id_photo) photo_count t_photo_auto group id_auto ) tpa on (t_auto.id_auto = tpa.id_auto) left outer join t_auto_marca t_auto_marca on t_auto.id_marca = t_auto_marca.id_marca group t_auto.id_auto
would possible without using subqueries , additional views?
thanks
Comments
Post a Comment