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 to one entry.it should have found the sum of age for each group formed in subquery and multiple entries dataset should be the output.
anant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.