Thanks!  That's exactly what I was looking for  = 3 )

----- Original Message -----
From: Morten Winkler Jørgensen <[EMAIL PROTECTED]>
To: Sheridan Saint-Michel <[EMAIL PROTECTED]>
Sent: Thursday, July 19, 2001 2:56 AM
Subject: Re: [PHP] MySQL Query


> Hi Sheridan,
>
> You wrote:
>
> SSM> I have a table that looks like
>
> SSM> Name | Type | X | Y
>
> SSM> Foo    | Ship  | 9 | 29
> SSM> Bar    | Base  | 9 | 29
>
> SSM> Is there any way I can write a query that selects
> SSM> everything with Type = Base, and X and Y = Foo's X and Y?
>
> SSM> ie
>
> SSM> "Select * from table where type = Base and X = {Foo:X} and Y =
{Foo:Y}";
>
> This should do the trick
>
> SELECT * FROM table WHERE type = "base" AND
>        x = (SELECT x FROM table WHERE name = "foo") AND
>        y  = (SELECT y FROM table WHERE name = "foo")
>
> The only drawback is that SELECT x FROM table WHERE name = "foo"
> must return a single value and alike for y. So I hope that in this
> example the field "name" is your primary key as that will guarantee
> success.
>
> --
> Kind regards,
>  Morten Winkler
>  Master Student at University of Southern Denmark
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to