mysql - output specific columns in SQL -
i want output 2 rows - title , sum. title comes orbiting_group_types table, while sum calculating during sql query. here query output orbiting_group_types joined sum column:
select * orbiting_group_types ogt left join ( select sum (val), orbiting_group_type_id report_orbiting_vals subrov subrov.orbiting_group_type_id = 4 group orbiting_group_type_id ) rov on ogt. id = rov.orbiting_group_type_id
i want output title , sum columns. how should modify query that?
try :
select ogt.title, rov.summ orbiting_group_types ogt left join ( select sum (val) summ, orbiting_group_type_id report_orbiting_vals subrov subrov.orbiting_group_type_id = 4 group orbiting_group_type_id ) rov on ogt. id = rov.orbiting_group_type_id
Comments
Post a Comment