इस क्वेरी को आजमाएं
SELECT Reason,COUNT(Reason) FROM
(
SELECT
id,
SUBSTRING_INDEX(SUBSTRING_INDEX(reasoncode, ',', n.digit+1), ',', -1) Reason
FROM
table1
INNER JOIN
(SELECT 0 digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3) n
ON LENGTH(REPLACE(reasoncode, ',' , '')) <= LENGTH(reasoncode)-n.digit
ORDER BY
id,
n.digit
) T
Group By Reason;
आउटपुट होगा:
REASON OCCURANCES
0 3
1 3
2 2
3 1