I have searched and tried and have not found the exact SQL code example I am looking for. I have multiple reps per an account (in rows) and need to spread these out into columns. I will have up to 3 for each account.
My source data looks like this:
+---------+-------+------+
| Account | Badge | Name |
+---------+-------+------+
| 123 | 456 | Bob |
| 123 | 789 | John |
| 123 | 654 | Carl |
+---------+-------+------+
I need it to look like this:
+---------+--------+-------+--------+-------+--------+-------+
| Account | Badge1 | Name1 | Badge2 | Name2 | Badge3 | Name3 |
+---------+--------+-------+--------+-------+--------+-------+
| 123 | 456 | Bob | 789 | John | 654 | Carl |
+---------+--------+-------+--------+-------+--------+-------+
Any help is greatly appreciated.