SELECT COUNT(d.id) AS КОЛИЧЕСТВО, (CASE WHEN d.status = '3' THEN 'ОШИБКА' ELSE 'УСПЕШНО' END) AS СТАТУС
FROM deal d
WHERE d.status IN ('3', '4')
GROUP BY d.status
SELECT COUNT(d.id) AS КОЛИЧЕСТВО, CASE WHEN d.status = '3' THEN 'ОШИБКА' ELSE 'УСПЕШНО' END AS СТАТУС
FROM deal d
WHERE d.status IN ('3', '4')
GROUP BY CASE WHEN d.status = '3' THEN 'ОШИБКА' ELSE 'УСПЕШНО' END