I presume that is just an example as people's names don't make very good
primary keys.
Something like
SELECT h2.*
FROM hotel h1, hotel h2
WHERE h1.name = 'BILL'
AND h1.room = h2.room
I haven't tried it so you'll have to play around with it a bit.
----- Original Message -----
From: "Jaime Teng" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 11, 2001 9:14
Subject: help with select
> Hi,
>
> I have a single table:
>
> CREATE TABLE hotel (name char(50),room char(20));
>
> name is unique.
> but there can be one or more person assigned to any single room.
>
> I would like to perform a query to determine:
> who are living with 'BILL'?
>
> currently, i tried using:
> 1. get the room where BILL is in.
> 2. then get who are in the same room as BILL.
>
> is it possible to do it in one single query?
>
>
> jaime
>
> ---------------------------------------------------------------------
> 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