Convert Row to Column in SQL Server

Last Reply 4 months ago By pandeyism

Posted 4 months ago


i have table structure like

Table 1

id  username

1     dharmendra

2      mudassar

Table 2

username   address

dharmendra     abc

dharmendra     bcd

dharmendra     efg

mudassar        abc

mudassar        bcd

so i want that row should be cover to column in SQL query like this

user name address 1 address2 address3 address4  so on if more addres

dharmendra    abc      def           ghi         efg

mudassar       abc        bcd