I have two table and one mapping table when the pivot between TableA and TableB is set.
Table A
+----+-------+
| Id | Level |
+----+-------+
| 1 | VIP1 |
| 2 | VIP2 |
| 3 | VIP3 |
| 4 | VIP4 |
| 5 | VIP5 |
+----+-------+
Table B
+----+----------+
| Id | Name |
+----+----------+
| 1 | Bank |
| 2 | Online |
| 3 | Transfer |
| 4 | Redeem |
+----+----------+
Mapping Table
+----+---------+-----------+--------+
| Id | LevelId | TableBId | Status |
+----+---------+-----------+--------+
| 1 | 1 | 1 | 0 |
| 2 | 1 | 2 | 1 |
| 3 | 2 | 3 | 1 |
| 4 | 5 | 1 | 0 |
| 5 | 5 | 2 | 1 |
| 6 | 5 | 3 | 1 |
+----+---------+-----------+--------+
I want to achieve something list this
+------+------+--------+----------+--------+
| Name | Bank | Online | Transfer | Redeem |
+------+------+--------+----------+--------+
| VIP1 | 0 | 1 | 0 | 0 |
| VIP2 | 0 | 0 | 1 | 0 |
| VIP3 | 0 | 0 | 0 | 0 |
| VIP4 | 0 | 0 | 0 | 0 |
| VIP5 | 0 | 0 | 1 | 0 |
+------+------+--------+----------+--------+
Here TableA and TableB is both dynamic and can be add at anytime in future.
i wanted to try by creating a view table. but i'm not getting an idea how to create it.