select g.gameid, g.homeid, h.name, g.awayid, a.name, g.datetime
from Games g, Teams h, Teams a
where g.datetime > @min_dt
 and g.datetime < @max_dt
 and h.teamid = g.homeid
 and a.teamid = g.awayid


On Mon, 30 Dec 2002 11:29:45 -0600, <[EMAIL PROTECTED]> wrote:

Hello,
This is my first post to the list, so if I am asking in the wrong place, I apologize.

I've got some trouble putting together a query with the following tables

Games: Teams:

gameid teamid
homeid name
awayid
datetime

i want to get all games within a certain timeframe, but also retrieve the team names for both the homeid and awayid (these are both links to the teams.teamid field).
Not sure how to get two results from the same table in one query.

Can anybody point me in the right direction.
thanks
gf


---------------------------------------------------------------------
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 <mysql-unsubscribe- [EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php





---------------------------------------------------------------------
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