Hi,

Your query will need to look like:

select
   G.datetime, A.name, B.name
from
   Games as G,
   Teams as A,
   Teams as B
where
   A.teamid = G.homeid and
   B.teamid = G.awayid and
   G.datetime < ? and
   G.datetime > ?
order by G.datetime

would be a good place to start


Regards


M
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 30 December 2002 17:11
To: [EMAIL PROTECTED]
Subject: query requiring two results from one table?


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