mysql - Count columns where -


my problem in db table, amx_admins_servers columns admin_id, server_id, custom_flags , use_static_bantime, looks like

database link

and need count columns (server_id) have value of 4, 7, 10, 12 , print

server_id 4  - x times server_id 7  - x times server_id 10 - x times server_id 12 - x times 

the sample data shows 4 servers; if there other servers, though, should not shown.

any ideas?

select server_id, count(*) x_times amx_admins_servers server_id in (4, 7, 10, 12) group server_id 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -