0

I would like to merge mysql results that have same id.

This is original result:

+----+-----------+---------------------+
| ID | Position  |        Email        |
+----+-----------+---------------------+
|  1 | Director  | john@example.org    |
|  1 | Marketing | bob@example.org     |
|  2 | Director  | steve@example.org |
+----+-----------+---------------------+

I tried group_concat(), but it merges results in same column

+----+--------------------+----------------------------------+
| ID |      Position      |              Email               |
+----+--------------------+----------------------------------+
|  1 | Director,Marketing | john@example.org,bob@example.org |
|  2 | Director           | steve@example.org              |
+----+--------------------+----------------------------------+

What i need is following:

+----+----------+---------------------+-----------+-----------------+
| ID | Position |        Email        | Position  |      Email      |
+----+----------+---------------------+-----------+-----------------+
|  1 | Director | john@example.org    | Marketing | bob@example.org |
|  2 | Director | steve@example.org   |           |                 |
+----+----------+---------------------+-----------+-----------------+

0 Answers0