I am trying to get all matching results from a one to many relationship in 1 result.
Table structure
Users owr_rosterdata
-------- --------
id| name id | user | info
----------- ---------------------
1 | nealvdv 1 | 1 | aaaa
2 | another 2 | 1 | bbbb
3 | 2 | cccc
4 | 2 | dddd
My current query is something like this (without the WHERE clauses)
"
SELECT owr_rosterdata.*, users.id, users.name FROM owr_rosterdata
INNER JOIN users ON owr_rosterdata.user = users.id
"
Current output
User 1: 1, nealvdv, aaaa
User 1: 1, nealvdv, bbbb
User 2: 1, another, cccc
User 2: 1, another, dddd
The whole point of this query is to avoid having multiple queries to get all matching results of a user into 1 result.
Desired output
User 1: 1, nealvdv, aaaa, bbbb
User 2: 2, another, cccc, dddd
Thank you for any suggestions!