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

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -