Rich,
Friday, December 06, 2002, 2:23:49 AM, you wrote:

RA> if i have the following mySQL tables

RA> create table list (
RA> id int,
RA> name char(20)
RA> );
RA> insert into list values(1, 'bob');
RA> insert into list values(2, 'joe');

RA> create table list2 (
RA> id1 int,
RA> id2 int
RA> );
RA> insert into list2 values(1,2);
RA> insert into list2 values(2,1);

RA> what query will return the following result

RA> result:
RA> ---------
RA> bob, joe
RA> joe, bob

Use JOINs :

SELECT l2.id1, l.name, l1.name
FROM list2 l2
LEFT JOIN list l ON l2.id1=l.id
LEFT JOIN list l1 ON l2.id2=l1.id;




-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




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