m******u 发帖数: 12400 | 1 show the name of all players who scored a goal against Germany?
table 1: game: columns (id, mdate, stadium, team1, team2)
table 2: goal: columns(matchid, teamid, player, grime)
table 3: eteam: columns (id, teamname, coach)
其中
game.id = goal.matchid
game.team1 (and team2) = eteam.id = goal.teamid | c*******e 发帖数: 8624 | 2 select b.player
from game a
join goal b
on a.id = b.matchid
join eteam c
on a.team1 = c.id
and c.teamname = 'Germany'
union
select b.player
from game a
join goal b
on a.id = b.matchid
join eteam c
on a.team2 = c.id
and c.teamname = 'Germany' ;
【在 m******u 的大作中提到】 : show the name of all players who scored a goal against Germany? : table 1: game: columns (id, mdate, stadium, team1, team2) : table 2: goal: columns(matchid, teamid, player, grime) : table 3: eteam: columns (id, teamname, coach) : 其中 : game.id = goal.matchid : game.team1 (and team2) = eteam.id = goal.teamid
| m******u 发帖数: 12400 | | m******u 发帖数: 12400 | 4 the query is not right. too many rows selected. | B*****g 发帖数: 34098 | 5 把他德进球的队员也算上了
1 试着把union 2部分合并
2 b.teamid和c.id不能一样
【在 m******u 的大作中提到】 : the query is not right. too many rows selected.
| m******u 发帖数: 12400 | 6 one more. Thanks.
Show the stadium and the number of goals scored in each stadium. | m******u 发帖数: 12400 | | m******u 发帖数: 12400 | 8 if I want to show game id, stadium and the name of the two teams (basically
it is the game table, just in game table the two teams are showed in teamid)
. I need use the game table to join the eteam table twice. Am I correct here
. Thanks. |
|