Re: Retrieving names from second table from id number
| From: | Joe Brown | Date: | Sat, 17 Mar 2001 03:36:17 +0000 |
| Subject: | Re: Retrieving names from second table from id number | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-7560@lists.php.net to get a copy of this message | ||
Hehe, sounds tricky.
There's prossibly a more elegant solution, but this one may work, aliasing
the master table a few times with different names:
SELECT s.*, r1.name, r2.name, r3.name
FROM schedule s, ref_master r1, ref_master r2, ref_master r3
WHERE s.ref1_id=r1.id
AND s.ref2_id=r2.id
AND s.ref3_id=r3.id
I sure it would work in Oracle, a little curious about it working in mysql.
Good Luck,
-Joe
""Brett"" <brett@jnewman.net> wrote in message
news:01a701c0ae6e$fcacea00$e1214ed8@bcnu...
> I am retrieving values to form a shedule for referees. The master shedule
> contains all info for a given date with three referees for that game. The
> three referees are refrenced by their id number from the referee
information
> table. I am now stuck trying to figure out how to take the three referee
> id's from the results and display the names and email address for each id.
> I am capable of writing a query to return the results from the master
> schedule table and the information for each id from the referee info
table,
> but do not know how to form the query so that where the id would be
> displayed I can display the name and email instead. I use mysql and I
hope
> I explained this in a reasonable way. Any comments suggestions will be
much
> appreciated.
>
> Brett
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>