write a query below (see the below table table data)
empcolumn empno
a 1
a 2
b 3
c 4
c 5
a 6
Output:
empcolumn subjects
a 1,2,6
b 3
c 4,5
write a query below (see the below table table data)
empcolumn empno
a 1
a 2
b 3
c 4
c 5
a 6
Output:
empcolumn subjects
a 1,2,6
b 3
c 4,5
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ajay Patel148 reputationPosted Apr 2, 2014, 5:14 AM EDT
select DISTINCT empcolumn, ( SELECT SUBSTRING((SELECT ','+subjects FROM table1 WHERE empcolumn = p.empcolumn for xml path ('')),2,1000) ) as Total from table1 p