Let's say I have these MySQL tables:
USERS:
| user-ID | Name |
|---|---|
| 1 | Saoirse |
| 2 | Gal |
| 3 | Margaret |
PAYMENTS
| pay-ID | user-IDs | Names |
|---|---|---|
| 1 | Margaret | |
| 2 | Saoirse, Gal, Margaret | |
| 3 | Gal, Saoirse |
What I need is to update through MySQL the column user-IDs of the payments table with a comma separated user-ID of each user, searching by the name. This should be the result:
| pay-ID | user-IDs | Names |
|---|---|---|
| 1 | 3 | Margaret |
| 2 | 1, 2, 3 | Saoirse, Gal, Margaret |
| 3 | 2, 1 | Gal, Saoirse |
Does anyone have a clue?
Thanks a million!