sql - How to select the sum of distinct values in a table using mysql -
slno state district company 1 ab abc 2 ab ac 3 ab abc 4 ab abc 5 ab abc 6 ab ac
output
state district company sumzz ab abc 4 ab ac 2
what have tried
select state,district,company,sum(company) sumzz company
how achieve display last row based on distinct company?
and what's wrong approach:
select state, district, company, count(*) countzz company group state, district, company
Comments
Post a Comment