Hi,Here's a view...CREATE VIEW dbo.GroupFolderPermissionsASSELECT g.GroupID, g.GroupName, SUM(CASE FolderPermissionID WHEN 1 THEN Allow ELSE null END) AS 'FolderPermissionID1', SUM(CASE FolderPermissionID WHEN 2 THEN Allow ELSE null END) AS 'FolderPermissionID2', SUM(CASE FolderPermissionID WHEN 3 THEN Allow ELSE null END) AS 'FolderPermissionID3', SUM(CASE FolderPermissionID WHEN 4 THEN Allow ELSE null END) AS 'FolderPermissionID4', SUM(CASE FolderPermissionID WHEN 5 THEN Allow ELSE null END) AS 'FolderPermissionID5', SUM(CASE FolderPermissionID WHEN 6 THEN Allow ELSE null END) AS 'FolderPermissionID6', SUM(CASE FolderPermissionID WHEN 7 THEN Allow ELSE null END) AS 'FolderPermissionID7', SUM(CASE FolderPermissionID WHEN 8 THEN Allow ELSE null END) AS 'FolderPermissionID8', SUM(CASE FolderPermissionID WHEN 9 THEN Allow ELSE null END) AS 'FolderPermissionID9', SUM(CASE FolderPermissionID WHEN 10 THEN Allow ELSE null END) AS 'FolderPermissionID10'FROM tbl_Groups gLEFT OUTER JOIN ( SELECT GroupID, FolderPermissionID, Allow FROM tbl_Folders_Groups_Permissions WHERE FolderID = 6 ) fgpON g.GroupID = fgp.GroupIDGROUP BY g.GroupID, g.GroupName
Simple question... is it possible to make the FolderID value (6) variable without making the view into a stored procedure and supplying the FolderID as a parameter?