mysql - How can i get number of entries and column name in a unique select? -



mysql - How can i get number of entries and column name in a unique select? -

i have next table:

idcolumn name role status 1 peter ope 0 2 peter adm 1 3 jon ope 1 4 mac adm 1 5 jon adm 0 6 peter sec 1

what wanted column name , number of entries each 1 in single query.

select name, count(*) table status = 1;

exit example:

--------------- name | count()| --------------- peter| 2 | jon | 1 | mac | 1 | ---------------

this basic group by query:

select name, count(*) table status = 1 grouping name;

if going utilize sql, should larn basics. group by , join basics of sql language.

mysql select count columnname

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -