Given the following table T:
------------------------------
| Person | PermissionTypeId |
------------------------------
| Jon | 1 |
------------------------------
| Jon | 2 |
------------------------------
| Adam | 1 |
------------------------------
And Table P:
------------------------------
| Id | PermDescription |
------------------------------
| 1 | Can Access Reports |
------------------------------
| 2 | Can Access Locker |
------------------------------
Suppose I want to write a query that returns one row of Jons permissions like this:
------------------------------------------------------
| Person | Can Access Reports | Can Access Locker |
------------------------------------------------------
| Jon | true | true |
------------------------------------------------------
Where true exists if there is a PermissionTypeId associated with the user. And false exists where there is not. Hence Adams query would return:
-----------------------------------------------------
| Person | Can Access Reports | Can Access Locker |
----------------------------------------------------
| Adam | true | false |
-----------------------------------------------------
How can I write the following query that returns this row?