Предположим, у меня есть таблица: organization_branches_custom_not_working_days
_________________________________________________________________________
|id | created_at | date | organization_branch_id |
_________________________________________________________________________
| 1 | 2020-03-01 21:42:05 | 2020-02-28 | 2 |
| 2 | 2020-03-01 21:42:05 | 2020-02-28 | 2 |
| 3 | 2020-03-01 21:42:05 | 2020-02-28 | 2 |
| 4 | 2020-03-01 21:42:05 | 2020-02-28 | 1 |
__________________________________________________________________________
Используя этот запрос:
SELECT organization_branch_id, GROUP_CONCAT(date SEPARATOR ', ') FROM organization_branches_custom_not_working_days GROUP BY organization_branch_id;