Off the top of my head: (so it may not work)

SELECT Inventory.*, 
       P1.name, 
       P2.name 
  FROM Inventory, 
       People P1, 
       People P2 
 WHERE Inventory.in_possession = P1.person_id and 
       inventory.returned_to = P2.person_id

Cal
http://www.calevans.com
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Cindy
Sent: Tuesday, January 23, 2001 6:32 PM
To: [EMAIL PROTECTED]
Subject: question on select



OK, let's say I have two tables.  The first is a table
full of people -- their names, address, phone numbers.

The second table is an inventory, which among other things,
has a pointer to the first table for who currently has possession
of the item.

so I select from the two tables to print out an inventory list:

SELECT Inventory.*, People.name FROM Inventory, People WHERE
Inventory.in_possession = People.person_id

No problem.

BUT, I'd like to add something where it gives an option of who the item
in question was returned to.  Unfortunately, I'm not sure how to do
that?  Becasue Inventory.returned_to would also need to pull out from
the People table, but this could be a different person, and I don't
see how to assign that.  Would I have to create a temporary table to
do this or can it be done with a single select?

--Cindy

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