My mysql table dummy looks like this:
name | number | some_value |
---|---|---|
A | 1 | 1 |
A | 2 | 4 |
A | 3 | 7 |
B | 1 | 1 |
C | 3 | 5 |
C | 4 | 4 |
... | ... | ... |
And i want to join the table on itself by each distinct name value where the number equals and then select only some_value and number as index once. I know sound a bit messy so here would be the example from above:
number | A.some_value | B.some_value | C.some_value | ... |
---|---|---|---|---|
1 | 1 | 1 | null | ... |
2 | 4 | null | null | ... |
3 | 7 | null | 5 | ... |
4 | null | null | 4 | ... |
I would be very grateful if someone could help me and tell me the query to do that.