I have a query in which I need to get the name & number (ID) of each *salesperson* involved in a *sale*.

```
SELECT 
    S.SaleID,
    P.PersonID,
    P.Name
FROM Sale S
LEFT JOIN PersonSales PS ON PS.SaleID = S.SaleID
LEFT JOIN Person P ON P.PersonID = PS.PersonID

```

But I have to PIVOT it to show as columns:

```
SELECT * FROM (
SELECT 
    S.SaleID,
    P.PersonID,
    P.Name,
    // - This will give me numbers 1+ for each Sale, per Person
    DENSE_RANK() OVER (PARTITION BY S.SaleID OVER P.PersonID) AS [Person#]
FROM Sale S
LEFT JOIN PersonSales PS ON PS.SaleID = S.SaleID
LEFT JOIN Person P ON P.PersonID = PS.PersonID
) AS Q
PIVOT (
    AGGREGATE(?) FOR [Person#] IN ([1], [2], [3], [4], [5])
) AS P

```

My question is how do I get the `Name` and `PersonID` if they're not aggregates and those two values in the pivot?

Like this:

```
SaleID    Name      ID    Name      ID
1         Seller A  1     Seller B  2
2         Seller C  3
3         Seller A  1     Seller C  3

```