php - Having max of column repeat for each row in mysql -


lets have table ,

a      user count          4     b      1     c      3     d      2  

i want write query returns each value of along max value of count,something

user  maxcount        4 b        4 c        4 d        4  

the way trying achieve is,

select user,max(count) maxcount 

the result :

user maxcount      4 

which not want.

i understand write multiple queries(i.e. 'select user a' /'select max(count) a') may seem redundant ,

but think having way best me don't want call mysql multiple times , push returned data single jsonobj front end , easier have single table combing 2 returned-tables 1 , converting json

this query give max value on rows:

select user,        (select max(count) yourtable) maxcount yourtable; 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -