I'm trying to create a SQL query that will left join multiple rows together based on a grouping factor. Hopefully someone can help.
Code 001A 001B 001C 002A 002B 002C 002D 002E
I would want a query that does
Where Code LIKE '001%' Then Left Join all the rows. Resulting in:
Code1 Code2 Code3 001A 001B 001C
In the data there would be variances in the number of codes that it would pick up for example on a
Where Code Like '002%':
Code1 Code2 Code3 Code4 Code5 002A 002B 002C 002D 002E
Any help would be much appreciated.