mysql计数null
我有一个game1桌子, 似乎是这样的:
player1 | player2 | result_1 | result_2 |
---|---|---|---|
team1 team1 | team2 | 10 | null |
team1 | team3 | 10 | null |
team2 team2 | team3 | 6 | null |
result_1是player1的结果,result_2是player2的结果。
我想在下表:
播放器 | count_null |
---|---|
team1 | 0 |
Team2 | 1 |
Team3 | 2 |
请帮助我
I have a game1 table,
it seems like this:
player1 | player2 | result_1 | result_2 |
---|---|---|---|
team1 | team2 | 10 | NULL |
team1 | team3 | 10 | NULL |
team2 | team3 | 6 | NULL |
result_1 is player1's result and result_2 is player2's result.
I want to make below table:
player | count_null |
---|---|
team1 | 0 |
team2 | 1 |
team3 | 2 |
Please help me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过将表列“分配”成更多的行来做到这一点,然后按播放器(团队)进行分组,然后总和1当结果为null时
You can do that by "dividing" the table columns into more rows, then group by player (team) and then sum 1 when the result is null