php - sql query to select count of only max value from table -



php - sql query to select count of only max value from table -

partyname state constituency candidatename district votes bjp maharashtra nagpur-east nitin gadkari nagpur 1200 aap maharashtra nagpur-east arvind kejriwal nagpur 750 bjp maharashtra nagpur-west vicky nagpur 4800 aap maharashtra nagpur-west lucky nagpur 3500 bjp maharashtra nagpur-north rakesh nagpur 100 aap maharashtra nagpur-north ravan nagpur 1500

below expected output above table

query select max vlue votes grouping partyname , constituency , display below output.

partyname count bjp 2 aap 1

bcoz bjp leads nagpur -east , nagpur west

so display count 2

and aap leads nagpur - north display 1 count.

plz suggest me query......

you can seek this:

select max(votes) tablename grouping constituency

sql fiddle :http://sqlfiddle.com/#!2/ceb017/1

php mysql

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -