Това е доста често срещан модел:
SELECT DAY_IN, COUNT(*) AS arr,
SUM(IF(PAT_STATUS like '%ong%', 1, 0)) AS ONG1,
SUM(IF(PAT_STATUS like '%rtde%', 1, 0)) AS RTED,
SUM(IF(PAT_STATUS like '%pol%', 1, 0)) AS POL1,
SUM(IF(PAT_STATUS like '%para%', 1, 0)) AS para
FROM t_hospital
WHERE DAY_IN between @start_check and @finish_check
and RES_DATE between @start_res and @finish_res
and ID_daily_hos [email protected]_hos
GROUP BY DAY_IN