Tengo el siguiente problema
Necesito hacer una consulta multiple a una tabla usando COUNT que permita guardar todos estos datos en un array.
la consulta es la siguiente:
Código SQL:
Ver original
(SELECT t1.conteo1,t2.conteo2,t3.conteo3,conteo4 FROM (SELECT COUNT(*) AS conteo1 FROM registro WHERE fecha_ocurrencia BETWEEN '2010-08-01' AND '2016-08-01') AS t1, (SELECT COUNT(*) AS conteo2 FROM registro WHERE clasificacion LIKE 'Centinela' GROUP BY registro.id HAVING fecha_ocurrencia BETWEEN '2010-08-01' AND '2016-08-01') AS t2, (SELECT COUNT(*) AS conteo3 FROM registro WHERE clasificacion LIKE 'Adverso' GROUP BY registro.id HAVING fecha_ocurrencia BETWEEN '2010-08-01' AND '2016-08-01') AS t3, (SELECT COUNT(*) AS conteo4 FROM registro WHERE clasificacion LIKE 'Incidente' GROUP BY registro.id HAVING fecha_ocurrencia BETWEEN '2010-08-01' AND '2016-08-01') AS t4 );
Funciona perfectamente y me arroja lo valores
[ 4 1 1 1]
El problema viene cuando la ultima consulta 'incidente' esta vacio en la tabla y el array me queda vacio :
[ ]
No se que será ayuda¡¡¡ por favor