This is probably quite easy, but I'm stuck on in regardless and my searches didn't come up with anything useful. I have data that currently is in this format:
ID Code
|1212050 | LB |
|1212050 | LJ |
|1212050 | LK |
|1212052 | FB |
|B12L076 | CL |
|B12L076 | LK |
There are many possible codes, but I need the query to display the first ten (even if the ID only has one) in this format:
ID Code1 Code2 Code3
|1212050 | LB | LJ | LK |
|1212052 | FB | | |
|B12L076 | CL | LK | |
I can easily create a crosstab query that creates a view with the codes as column headings, but that creates to many columns. I need it to have columns with labels of "Code1" through "Code10", regardless of which codes are used in the IDs. Here's the kicker: It has to be in Access sql.
Any help would be greatly appreciated.
The test group I will be using to test the query is:
ID Code
|1212044| LJ|
|1212044| LJ|
|1212044| LJ|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| LB|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| HT|
|1212050| CL|
|1212050| LK|
|1212050| LK|
|1212050| LK|
|1212050| CL|
|1212050| LK|
|1212050| CL|
|1212050| LK|
|1212050| CL|
|1212050| LK|
|1212050| LJ|
|1212052| FB|
|1212052| FB|
|1212052| LB|
|1212052| FB|
|B12L076| CL|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L076| CL|
|B12L076| LK|
|B12L103| LB|
|B13A072| CL|
|B13A072| LK|
|B13A072| HT|