samedi 25 juin 2016

SQL Pivot no aggregate

I am looking to pivot a data set result out but there is no aggregate that is happening.

Select StufferID from from #temp_Stuffers where SponsorID IN (111,222,333)

This is going to give me 0 - 2 results. How can I use pivot to make it

Sponsor ID    StufferID1   StufferID2
111            S1           S2
222            S5
333

Rather than

SponsorID     StufferID
111           S1
111           S2
222           S5

Aucun commentaire:

Enregistrer un commentaire