This seems easy but haven't found the magic search term yet.
One table
ID | UserID | Mod_number
1 43 1
2 43 2
3 43 3
4 43 4
5 55 1
6 55 2
I want to return a query that looks like:
UserID | Mod_1&ID | Mod_2&ID .... [EDITED below]
43 | 1&1 | 2&2 ....
55 | 1&5 | 2&6 ....
The Mod numbers are fixed (there are 7 of them).
The concatenation I know how to do, it's the rearranging values into rows that's tripping me up.
Any help or direction would be awesome, thanks! :)
====================== EDIT:
Hoping that the downvote was lack of clarity than quality of question - let me try to explain better.
This is for an assessment tool being developed in Joomla. Each module (section) gets checked off by a supervisor. When that happens there's an ID, a UserID, and a ModID recorded (among other data).
That results in a table that looks like this:
ID | UserID | Mod_number
1 43 1
2 43 2
3 43 3
4 43 4
5 55 1
6 55 2
7 61 2
8 61 4
Each UserID is a user. I need to form this into an array where each row is one user and also contains the ID for each module. I think this presentation might be clearer (skipping the concatenation):
UserID | ID_M1 | ID_M2 | ID_M3 |ID_M4
43 | 1 | 2 | 3 | 4
55 | 5 | 6 |
61 | | 7 | | 8
So that now there's one unique UserID per row (could be considered a key) with the ID recorded for each Module number. As an array that would probably look something like array(UserID=>array(ID_M1, ID_M2, ID_M3, ID_M4)). But getting that data into this is befuddling me.
Also, if you have other suggestions on structuring the data that would make it easier I'd love to hear - I'm a bit new to php/mysql/Joomla dev and there could be a simpler way of doing this.
Hope that makes more sense, thanks!