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


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to