Hi.
Presuming you have the team names in a seperate table, you could write
something like:
SELECT home.name, away.name, winner.name
FROM games, teams AS home, teams AS away, teams AS winner
WHERE home.id = games.homeid AND
away.id = games.awayid AND
winner.id = games.winnderid AND
<whatever needed to get the 15 games in question>
If that does not help, you have to show us your table layout at least
with the queries you are using currently.
Regards,
Benjamin.
On Tue, May 28, 2002 at 08:16:44AM -0400, [EMAIL PROTECTED] wrote:
> I'm sort of new/rusty to SQL and I was trying to figure out the best way to
> do this problem. I'm creating a database for tracking a football pool. I'm
> kind of stuck on displaying the Games database. The Games database has a
> home team ID and an away team ID as well as the winning team ID. Thus I need
> to do three "lookups" per record on the Teams database to get/display the
> full name of the teams for viewing.
>
> Is the best way to do this is by using temporary tables for merging? There
> are about 15 games that need to be displayed at once. I'm using PHP for the
> interface to MySQL, so I know I could also do it using arrays. But I would
> presume I would want to stay away from doing 45+ selects (3 x 15).
>
> Any ideas/advice are appreciated.
--
[EMAIL PROTECTED]
---------------------------------------------------------------------
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