I have a SQL Server table table_name like:
col1            col2
SomeString_1    23
SomeString_1    65
SomeString_1    300
SomeString_1    323
What I want to do is for one unique value in col1, I want to select all the values from col2 but each in it's own column.
So the query should be something like:
select col2 from table_name where col1 = 'SomeString_1';
But I need output in the form:
23  65  300 323
Basically each selected value should be in it's own column. So the result should always have one row and as many columns as the SomeString_1 is repeated.
I tried to search on SO but few questions I found had different conditions.
 
     
     
    