Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Put multi record in one field output

$
0
0

I need get multi records data in to one field output for report purpose.

I would like to know are there any easier way to do it without using cursor for SQL 2008.

For example, I have following data and table

tblMaster

MaterID  MasterCode DetailsID

  1                   A              1

   1                   A            2

   2                   B            1

   2                    B           3

tblDetails

DetailsID   DetailsCode

   1               a

   2                b

   3                c

I want to my result set is

MasterID   DetailsCode

  1                   a,b

   2                  a,c

   I used to use cursor when I use SQL 2000.

   I would like to know any better way to use SQL 2008.

  Your information and help is great appreciated,

Regards,

  Souris,


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>