SELECT a.id,a.phone,GROUP_CONCAT(b.device, ',' ,b.address separator ',') AS devices FROM users AS a LEFT JOIN devices AS b ON a.id = b.user_id GROUP BY a.id;
+------+--------+-----------------------------------------+
| id | phone | devices |
+------+--------+-----------------------------------------+
| 1 | phone1 | router1,192.168.0.1,router2,192.168.1.1 |
| 2 | phone2 | router1,192.168.3.1 |
| 3 | phone3 | NULL |
+------+--------+-----------------------------------------+