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

Pivot on a Group without the same number of elements

$
0
0

I have an table with an ID and a description

4   bob
4   sam
5   mike
5   Bill
5   joe
6   sally
6   jill
6   pat
6   kim
6   sue

I need the out put to be like this

ID   F1       F2     F3    F4     F5
4     bob     sam 
5     mike   Bill    joe
6     sally    jill     pat   kim   sue

I wont have more than 5 names


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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