SQL: Query to order colums to rows based on type

Viewed 32

I've been working on a report based on SCCM data. ;-)

SELECT DISTINCT ResourceID
            ,   AdapterType0
            ,   MACAddress0

FROM    V_GS_NETWORK_ADAPTER 

WHERE   MACAddress0 is not null

I get a result like this:

ResourceID AdapterType0 MACAddress0
16777255 Ethernet 802.3 00:00:00:00:00:00
16777255 Ethernet 802.3 11:11:11:11:11:11
16777255 Wide Area Network (WAN) 33:33:33:33:33:33

But I would like to turn it around and get a result like

ResourceID AdapterType0 AdapterType1 AdapterType2
16777255 Ethernet 802.3: 00:00:00:00:00:00; 11:11:11:11:11:11 Wide Area Network (WAN): 33:33:33:33:33:33 NULL

I've tried with STUFF, but can't quite get the result I want.

1 Answers

SELECT ResourceID,AdapterType0,AdapterType1,AdapterType2

FROM V_GS_NETWORK_ADAPTER WHERE ResourceID='16777255'and AdapterType2 is NULL

Related