我有以下数据的福利表
id | Name
----------------
1 | Shopping
2 | Travel
3 | Fuel
4 | Lifestyle
5 | Airline
6 | Entertainment
7 | Golf
我还有另一个名为 Plan 的表,其中包含以下数据
Plan_id Benefit_id
---------------------
101 | 1
101 | 2
101 | 3
102 | 2
102 | 4
102 | 6
102 | 1
103 | 7
103 | 1
104 | 4
104 | 5
现在,我想使用如下表显示数据。
Plan_id | Shopping |Travel |Fuel |Lifestyle |Airline |Entertainment|Golf
---------------------------------------------------------------------------------
101 | yes | yes | yes | no | no | no | no
102 | yes | yes | no | yes | no | yes | no
103 | yes | no | no | no | no | no | no
104 | no | no | no | yes | yes | no | no