I have a column called "feedback", and have 1 field called "emotions". In those emotions field, we can see the random values and random length like
emotions |
---|
sad, happy |
happy, angry, boring |
boring |
sad, happy, boring, laugh |
etc with different values and different length. so, the question is, what's query to serve the mysql or postgre data:
emotion | count |
---|---|
happy | 3 |
angry | 1 |
sad | 2 |
boring | 3 |
laugh | 1 |
based on SQL: Count of items in comma-separated column in a table we could try using
SELECT value as [Holiday], COUNT(*) AS [Count]
FROM OhLog
CROSS APPLY STRING_SPLIT([Holidays], ',')
GROUP BY value
but it wont help because that is for sql server, not mysql or postgre. or anyone have idea to translation those sqlserver query to mysql? thank you so much.. I really appreciate it