Re: [PHP-DB] Selecting two names from a table

2003-10-06 Thread Shaun
Thank you!


"Jacob A. Van Zanen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Try something like this:
>
> SELECT U1.User_Name
> , U2.User_Name
> , B.Booking_Date
> FROM USER U1
> , USER U2
> , BOOKING B
> WHERE B.Booking_Creator = U1.User_ID
> AND B.Booked_User = U2.User_ID'
>
> Jack
>
>
>
> -Original Message-
> From: Shaun [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 06, 2003 11:24 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Selecting two names from a table
>
>
> 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
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Selecting two names from a table

2003-10-06 Thread Jacob A. van Zanen
Hi,

Try something like this:

SELECT  U1.User_Name
,   U2.User_Name
,   B.Booking_Date 
FROMUSER U1
,   USER U2
,   BOOKING B 
WHERE   B.Booking_Creator = U1.User_ID 
AND B.Booked_User = U2.User_ID'

Jack



-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 06, 2003 11:24 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Selecting two names from a table


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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php