get number of users of different type
I got table Users
with field type = enum('admin', 'editor', 'regular')
.
how can i get number of admins, editors and regular users in one query?
My solution was in 3 queries like: SELECT COUNT(*) FROM us开发者_如何学运维ers WHERE type='admin'
using group by
SELECT COUNT(*) as count ,type FROM users group by type
精彩评论