mysql - how can i get the number of times a specific word occur in my sql -


please how can number of times, specific word occur in table? have table called result , field called president.

index - president   1 - james   2 - john   3 - john   4 - john   5 - james   6 - john  

i tried using following codes number of times john occur in table.

select count(`president`) `result` `president`="john" 

but, it's writing syntax error. n.b: need number of times john appeared expected four(4).

you can try mate:

select     president, count(index) 'occured'     result     president = 'john';   

e: 1 specific 'john' only.

select     president, count(index) 'occured'     result group     president;   

e: display count each result.president in database. cheers!


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -