Hi,
I need some help with a query
I have two queries that I'd like to merge into one - one returns a list of matches that a player has played in, and the other returns the players batting performance. My problem is that a player doesn't always bat, and therefore can have fewer rows in the second query.
The queries are as follows:
SELECT MatchNo, ShortTeamName
FROM PlayerInTeamInstance, AMatch, TeamInstance, Team, Competition
WHERE PITIPlayerID = 1 AND
MatchNo = PITIMatchNo AND
PITITeamID != TITeamID AND
PITIMatchNo = MatchNo AND
TIMatchNo = MatchNo AND
TITeamID = TeamID AND
MatchCompID = CompID
ORDER BY MatchDate ASC
SELECT DISTINCT MatchNo, BattingInnings.Total)Total
FROM BattingInnings, AMatch, TeamInnings
WHERE BatIMatchNo = MatchNo
AND BatIPlayerID = 1 AND
InningsNo = BatIInningsNo AND
(IBatTeamID = HomeTeamID OR IBatTeamID = AwayTeamID)
ORDER BY MatchDate ASC
I'd be greatful for any help,
Fraser
I need some help with a query
I have two queries that I'd like to merge into one - one returns a list of matches that a player has played in, and the other returns the players batting performance. My problem is that a player doesn't always bat, and therefore can have fewer rows in the second query.
The queries are as follows:
SELECT MatchNo, ShortTeamName
FROM PlayerInTeamInstance, AMatch, TeamInstance, Team, Competition
WHERE PITIPlayerID = 1 AND
MatchNo = PITIMatchNo AND
PITITeamID != TITeamID AND
PITIMatchNo = MatchNo AND
TIMatchNo = MatchNo AND
TITeamID = TeamID AND
MatchCompID = CompID
ORDER BY MatchDate ASC
SELECT DISTINCT MatchNo, BattingInnings.Total)Total
FROM BattingInnings, AMatch, TeamInnings
WHERE BatIMatchNo = MatchNo
AND BatIPlayerID = 1 AND
InningsNo = BatIInningsNo AND
(IBatTeamID = HomeTeamID OR IBatTeamID = AwayTeamID)
ORDER BY MatchDate ASC
I'd be greatful for any help,
Fraser