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
加载中,请稍侯......
精彩评论