why doesnt groups goes to main query when grouped by in subquery
select sum(age),customer_id from (select age,customer_id from customers group by first_name) in this first customers table is grouped by first_name and then age and customer_id is selected.my doubt is that why groups are not going from sub query to main query but the first elements of each group.thus sum(age) collapses the entire data from sub query […]