2016-09-28 70 views

回答

0
SELECT PermID, 
ISNULL([New_User],0)as [New_User],ISNULL([Edit_User],0)as [Edit_User] ,ISNULL([Permission],0) as [Permission] ,ISNULL([Store-Credit],0)as [Store-Credit],ISNULL([Refund],0) as [Refund] ,ISNULL([Gift_Certificate],0)as [Gift_Certificate] 
FROM 
(SELECT PermID, Fname,'0' AS Active 
    FROM F3_BC_Users_Permissions_Master) AS SourceTable 
PIVOT 
(
max(Active) 
FOR fname IN ([New_User],[Edit_User],[Permission],[Store-Credit],[Refund],[Gift_Certificate]) 
) AS PivotTable;