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

Pivot or CTE may solve this issue.

$
0
0

This is my first time using pivot or cte 

I have this in my db.table

Fname PhoneTypePhoneNumber

1 Roman Work3033331111
2Roman Cell3033332222
3Roman Fax3033333333
4Frank Work3034441111
5Frank Cell3034442222
6Frank Fax3034443333
7Charlie Work3035551111
8Charlie Cell3035552222
9CharlieFax3035553333
10Andrea Work3036666666

from that I want the result look like this.

FnameWorkphone Cellphone Fax

Roman3033331111  3033332222 3033333333

Frank 3034441111 30344422223034443333

Charlie 3035551111 30355522223035553333

Andrea3036666666 

Sorry the data doesn't show inline.

Please help Thanks.






Viewing all articles
Browse latest Browse all 23857

Trending Articles



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