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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -