【发布时间】:2017-11-23 18:19:57
【问题描述】:
我正在编写一个自定义搜索框来查找星际争霸游戏,但我不知道如何进行查询。例如,用户搜索“玩家:daniel,玩过:'x' 地图上的 zerg vs terran 玩家”
所以我有这个表:
桌面游戏
+------------+----------+-------------+----------+
| game_id | map | match | winner |
+------------+----------+-------------+----------+
| 7 | y | 1v1 | 1 |
| 8 | x | 1v1v1 | 2 |
| 9 | w | 1v1v1 | 3 |
| 10 | x | 1v1 | 1 |
+------------+----------+-------------+----------+
桌面玩家
+------------+----------+-------------+----------+
| game_id | player |Civilization | team |
+------------+----------+-------------+----------+
| 7 | Arturo | protos | 1 |
| 7 | Daniel | zerg | 2 |
| 8 | Ale | Terran | 1 |
| 8 | Maria | Protos | 2 |
| 8 | Daniel | zerg | 3 |
| 9 | Pablo | zerg | 1 |
| 9 | Ale | protos | 2 |
| 9 | Maria | protos | 3 |
| 10 | Daniel | zerg | 1 |
| 10 | Oscar | terran | 2 |
+------------+----------+-------------+----------+
通过正确的查询,我必须得到:
Game_id: 8, 1v1v1, daniel (zerg) vs maria (protos) vs ale (terran), map: x
Game_id:10, 1v1, daniel (zerg) vs oscar (terran), map: x
这里的问题是我如何在存在丹尼尔玩家和虫族文明并且对手在同一个game_id中拥有人族文明的情况下获得游戏??!而且游戏也是在x地图上玩的?
PD:正如您所注意到的,每个游戏都可以有不同规模的玩家。请帮忙。非常感谢
【问题讨论】:
-
这闻起来像家庭作业。你有没有尝试过?
-
什么都没有,我不知道怎么做 :(
-
至少,您还应该包括预期的输出。
标签: mysql