0

Here is an example table: users

User table

| id | languages                     |
| -- | --------------                |
| 1  |  Arabic, English, Spanish     |
| 2  | English, Other                |
| 3  | English, Arabic               |

Expect output

| language | total |
| -------- | ----- |
| Arabic   | 2     |
| English  | 3     |
| Spanish  | 1     |
| Other    | 1     |
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • 3
    Fix your data model! Don't store multiple values in a string. – Gordon Linoff Apr 22 '21 at 11:41
  • 1
    Parse your CVS values to separate values then aggregate. – Akina Apr 22 '21 at 11:45
  • Doesn't answer the question with the strings, but here's a fiddle if you change you're data https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=786b5021507d90c638aaf7bcf58d9cae –  Apr 22 '21 at 12:01

0 Answers0