I have two tables: users [id, email] and roles [id, name] with many-to-many connection table user_has_roles [user_id, role_id]. I'm trying to get table which showing which user has particular role and if not then null (or 0) similar to following:
| role 1 | role 2 | role 3
---------------------------------------
user1@email | 1 | null | 1
user2@email | null | null | 1
---------------------------------------
Much appreciate any help on this.