This will do it for you:
--Creating Tables
Create Table Permission
(permissionId int, permission varchar(20))
Create Table UserPermissions
(userId varchar(2),
permissionId int)
--Inserting Sample Data into Tables
Insert Into Permission
Select 1, 'SALES'
union ALL
Select 2, 'PURCHASES'
union ALL
Select 3, 'SALES RETURN'
union ALL
Select 4, 'HR MANAGEMENT'
Insert Into UserPermissions
Select 'aa', 2 -- means user aa has permission to access sales page
Union ALL
Select 'aa', 4
Union ALL
Select 'bb', 1
Union ALL
Select 'bb', 2 --as another example, bb has permission to access purchase page
Union ALL
Select 'cc', 4
--Query for your Requirement
Select a.Permission,
Max(Case When b.UserId = 'aa' Then 'Y' Else '' End) as aa,
Max(Case When b.UserId = 'bb' Then 'Y' Else '' End) as bb,
Max(Case When b.UserId = 'cc' Then 'Y' Else '' End) as cc
From Permission as a
Full JOIN UserPermissions as b on a.permissionId = b.permissionId
Group By a.permission
N 28° 33' 11.93148"
E 77° 14' 33.66384"