Here is how you could do this in sql server. This is known as a crosstab, some people call this a conditional aggregate. Another option would be to use a PIVOT. I find the syntax for a crosstab less obtuse than pivot and it generally has a very slight advantage for performance.
You can read more about this technique here. http://www.sqlservercentral.com/articles/T-SQL/63681/. Or if you don't know how many columns you will need to do a dynamic version of this. You can read about that here. http://www.sqlservercentral.com/articles/Crosstab/65048/
create table #Something
(
Id char(5)
, User_name varchar(20)
, User_id int
)
insert #Something
select 'DT122', 'Doe, John', 123 union all
select 'DT122', 'Yum, Mi', 124
select Id
, MAX(case when RowNum = 1 then User_Name end) as UserName1
, MAX(case when RowNum = 2 then User_Name end) as UserName2
from
(
select ID
, USER_NAME
, USER_ID
, ROW_NUMBER() over (PARTITION BY Id order by user_name) as RowNum
from #Something
) x
group by x.Id
drop table #Something