我有下表:
+----+----------+------------+
| id | drink | gender |
+----+----------+------------+
| 1 | Beer | m |
| 2 | Milk | f |
| 3 | Milk | f |
| 4 | Tea | m |
+----+----------+------------+
现在我想计算哪种性别更喜欢哪种饮料。结果应如下所示:
+-------+-------+--------+
| drink | fem | male |
+-------+-------+--------+
| Beer | 0 | 1 |
| Milk | 2 | 0 |
| Tea | 0 | 1 |
+----+----------+--------+
有人有想法吗?
提前感谢您的建议。