Contar registros con diferentes condiciones

CONTAR REGISTROS CON DIFERENTES CONDICIONES EN UNA SÓLA CONSULTA

use Lote
SELECT lote, count(codprenda) as TotalPrendas, count(case when embolsada = 1 then 1 else null end) as Embolsadas, count(case when embolsada = 0 then 1 else null end) as NoEmbolsadas
FROM loteformado group by lote

contar registros

 

 

 

Ejemplo con campos de texto:

select count(case when Position = 'Manager' then 1 else null end) as ManagerCount, count(case when Position = 'Supervisor' then 1 else null end) as SupervisorCount, count(case when Position = 'Team Lead' then 1 else null end) as TeamLeadCount, from ...