In my database, I have to select a query like this.
mysql> SELECT
-> @rownum := @rownum + 1 as id,
-> GROUP_CONCAT(DISTINCT id SEPARATOR ", ") as container_ids
->
-> FROM barang
-> CROSS JOIN (SELECT @rownum := 0) r
->
-> GROUP BY barang.arrival_day, barang.carrier
-> ORDER BY barang.arrival_day ASC
->
-> LIMIT 5;
+-----------+---------------------------------------+
| item_id | container_ids |
+-----------+---------------------------------------+
| 1 | 1, 2 |
| 2 | 3 |
| 3 | 4 |
| 4 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 |
| 5 | 16, 17 |
+-----------+---------------------------------------+
5 rows in set (0.00 sec)
My goal is to manipulate the query again so it will be get the result like this,
+-----------+----------------------------------------+
| item_id | container_ids |
+-----------+----------------------------------------+
| 1 | 1 |
| 1 | 2 |
| 2 | 3 |
| 3 | 4 |
| 4 | 5 |
| 4 | 6 |
| 4 | 7 |
| 4 | 8 |
| 4 | 9 |
| 4 | 10 |
| 4 | 11 |
| 4 | 12 |
| 4 | 13 |
| 4 | 14 |
| 4 | 15 |
| 5 | 16 |
| 5 | 17 |
+-----------+---------------------------------------+
What keyword if I have a case like this. Please advise.