Q:

How to display data of multiple row into one string

I have a table named Skill which store the skills data.
the skill level '2337' is the Advanced , '2338' is the Intermediate, '2339' is the beginner .
I want to display the skills name data based on the skill level that looks like this
For example,
Technical Profile_ID = 33
Advanced = Javascript, SQL, C#
Intermediate = Php
Beginner = vb,Java
I'm new to VB, can anyone help me to solve this.I'm using VB.net and database Microsoft SQL

A:

You can try this
create table #temp (skillid int, technicalprofile_id int, skilllevel int, skillname varchar(50))
insert into #temp values 
(35, 21, 2339, 'Php'),
(36, 21, 2339, 'Laravel')

SELECT skilllevel, skillname = 
    STUFF((SELECT ', ' + skillname
           FROM #temp b 
           WHERE b.skilllevel = a.skilllevel 
          FOR XML PATH('')), 1, 2, '')
FROM #temp a where skilllevel = 2339
GROUP BY skilllevel

The output is as shown below
skilllevel  skillname
2339        Php, Laravel

