I have a table called usuarios
which has several fields, one of them is the field estado_usuario
which has as parameter 0, means the user is disabled and 1 which means that the user is valid.
I need to count the number of current users and not valid but I do not know if it is possible to show both of them in 1 query.
for now I can only get in 2 query the respective amount of each state of validity
SELECT COUNT(ESTADO_USUARIO) FROM USUARIOS WHERE ESTADO_USUARIO= 0; <--- (me da 150)
SELECT COUNT(ESTADO_USUARIO) FROM USUARIO WHERE ESTADO_USUARIO= 1; <----- (me da 320)
The idea is as I said earlier to get both results in 1 query, but I do not know how I could do it ... it could also be a stored procedure.
My database engine is SQL SERVER 2008.