Match表:有字段 matchId, hostTeamId, guestTeamId, matchResult, matchTime;
Team表:有字段 teamId, teamName;
查处2006-6-1到2006-7-1之间的所有比赛, 并根据时间排序, 格式为 曼联 2:1 切尔西 2006-6-1我这里写了一个sql查询但是不对,希望大家帮我该一下:
select Team.Name, Match.match.matchResult, Team2.Name, Match.matchTime
from Match inner join
Team Team2 on Match.hostTeamId = Team.teamId and Match.guestTeamId = Team2.teamId
where (Match.matchTime > '2007-6-1') and (Match.matchTime < '2007-7-1')
order by Match.matchTime thx!
Team表:有字段 teamId, teamName;
查处2006-6-1到2006-7-1之间的所有比赛, 并根据时间排序, 格式为 曼联 2:1 切尔西 2006-6-1我这里写了一个sql查询但是不对,希望大家帮我该一下:
select Team.Name, Match.match.matchResult, Team2.Name, Match.matchTime
from Match inner join
Team Team2 on Match.hostTeamId = Team.teamId and Match.guestTeamId = Team2.teamId
where (Match.matchTime > '2007-6-1') and (Match.matchTime < '2007-7-1')
order by Match.matchTime thx!
FROM Team INNER JOIN Match ON Team.teamId=Match.hostTeamId INNER JOIN Team Team_2
on Match.guestTeamId=Team_2.teamId
from Match inner join Team
on (matchTime > '2007-6-1') and (matchTime < '2007-7-1')
order by matchTime
where matchTime > '2007-6-1'
and Match.matchTime < '2007-7-1'
select a.teamName Name1,matchResult,b.teamName Name2,matchTime
from Match left join team a on a.teamid=guestTeamId left join team b on b.teamid=guestTeamId
where matchTime>'2007-6-1' and matchTime< '2007-7-1'
where matchTime > '2007-6-1'
and Match.matchTime < '2007-7-1'