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

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -