I have a table in this format.

ROLES TABLE:

```
USERID  ROLE
------  -----
  1      A
  1      B
  2      B
  2      C 

```

I want to create a report that will look like this.

```
USERID   A   B   C
------- --- --- ---
  1      Y   Y   N
  2      N   Y   Y

```

---

I tried using pivot, but not getting the exact result. Here is what I tried,

```
SELECT * FROM
(SELECT USERID,ROLE from ROLES) 
pivot(MAX(ROLE) for ROLE in ('A','B','C'))` 

```

I need Y/N. I guess I need to use some decode fun instead of max(role).

PLEASE HELP.