Selecting two names from a table
| From: | Shaun | Date: | Mon, 06 Oct 2003 09:23:47 +0000 |
| Subject: | Selecting two names from a table | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-30871@lists.php.net to get a copy of this message | ||
Hi,
I have a table called Bookings and a table called User. Bookings are created
and hold the User_ID of the User who created it (Booking.Booked_User) and
the User who will be going on the booking (Booking.Booking_Creator). How can
I create a report that lists both users on each row. If I do 'SELECT
U.User_Name, B.Booking_Date FROM WMS_User WHERE B.Booking_Creator =
U.User_ID AND B.Booked_User = U.User_ID', then the query returns no data. So
for each row in the table I need to somehow select 2 names from the user
table based on 2 different User_ID's held in the Bookings table. Any help
would be greatly appreciated.
Thanks for your help