
27/02/2014, 09:26
|
| | Fecha de Ingreso: diciembre-2011
Mensajes: 77
Antigüedad: 13 años, 1 mes Puntos: 2 | |
Respuesta: Optimizar consulta de selección contando ocurrencias en por columnas Ya lo resolví de a siguiente manera:
SELECT
COUNT (case when isnull(A,'') in ('Error1','Error2') then 0 end) as Col_1,
COUNT (case when isnull(B,'') in ('Error1','Error2') then 0 end) as Col_2,
COUNT (case when isnull(C,'') in ('Error1','Error2') then 0 end) as Col_3
FROM TABLA
whereCONDICIÓN |