在将多列转换为多行时,如何“取消透视”此 SQL 查询?我还没有找到包含字符串数据的类似示例。
我正在使用以下查询:
SELECT MIN(DISTINCT CASE WHEN ARP.DisplayName0 = 'Adobe Reader XI (11.0.01)' AND
ARP.Version0 = '11.0.01'
THEN 'Adobe Reader XI (11.0.01) is Complaint'
ELSE 'Adobe Reader XI (11.0.01) is not Complaint'
END) as Reader,
MIN(DISTINCT CASE WHEN ARP.DisplayName0 = 'QuickTime' AND
ARP.Version0 = '7.73.80.64'
THEN 'Apple QuickTime is Complaint'
ELSE 'Apple QuickTime is not Complaint'
END) as Quicktime,
MIN(DISTINCT CASE WHEN ARP.DisplayName0 = 'McAfee Host Intrusion Prevention' AND
ARP.Version0 = '8.00.0202'
THEN 'McAfee HIPS is Complaint'
ELSE 'McAfee HIPS is not Complaint'
END) as 'McAfee HIPS'
FROM dbo.v_Add_Remove_Programs AS ARP
RIGHT OUTER JOIN dbo.v_R_System AS SYS ON ARP.ResourceID = SYS.ResourceID
WHERE (SYS.Netbios_Name0 = 'ese-pkg-04a')
GROUP BY SYS.Netbios_Name0, SYS.ResourceID
返回的内容:
Reader Quicktime McAfee HIPS
Adobe Reader XI (11.0.01) is Complaint Apple QuickTime is not Complaint McAfee HIPS is not Complaint
我想要的格式:
- Reader Adobe Reader XI (11.0.01) 是投诉
- Quicktime Apple QuickTime 不是投诉
- McAfee Hips McAfee HIPS 不是投诉