sql - Need unique value of a column while combining two tables -


i'm getting 2 columns 2 different tables using sql server 2005.. used following query..

select [mhd].jobpostingid,        [c].candidatename            candidate c right join memberhiringdetails mhd                        on [mhd].memberid=[c].id 

it returns following data:

jobpostingid  candidatename 60            aaa 60            bbb 63            aaa 

null means, candidate erased table.. need output follows:

jobpostingid  candidatename 60            aaa, bbb 63            aaa 

how this..? if need stored procedure means, ok.. need solution..

agreed mahmoud gamal, duplicate. extracted post , changed tables:

select c.name,        stuff((select ','+ c.candidatename                candidate c               c.id = mhd.memberid             xml path(''), type).value('.','varchar(max)'), 1, 1, '')  memberhiringdetails mhd  

thx omg ponies in post: how create comma-separated list using sql query?


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -