Re: [PHP] Problem with self join

2004-11-29 Thread Raditha Dissanayake
Robin Vickery wrote:
On Mon, 29 Nov 2004 14:12:23 +0530, suneel
<[EMAIL PROTECTED]> wrote:
 

Hi...
   Please take a look at the following...
   I'm using MySQL 4.0.15
   I have the database like this
   

This should really go to a MySQL list, but...
 

please keep the discussion on topic.

--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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


Re: [PHP] Problem with self join

2004-11-29 Thread Robin Vickery
On Mon, 29 Nov 2004 14:12:23 +0530, suneel
<[EMAIL PROTECTED]> wrote:
> Hi...
> Please take a look at the following...
> 
> I'm using MySQL 4.0.15
> I have the database like this
> 
>Id name Owner
> 1Top Menu0
> 2File   1
> 3Open1
> 4Text File   2
> 5Dot Net2
> 6ASP.Net   5
> 7C#.Net  5
> 
>   In the above data the Id's 6 & 7  are not owner to any one.So,I
> want to retrieve those Id's which are not owner to any one.

This should really go to a MySQL list, but...

If your table is called "menus", this should do the job.

SELECT a.* 
  FROM menus a LEFT JOIN menus b ON a.Id = b.Owner 
  WHERE b.Owner IS NULL

-robin

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



Re: [PHP] Problem with self join

2004-11-29 Thread Raditha Dissanayake
suneel wrote:
Hi...
   Please take a look at the following...
   I'm using MySQL 4.0.15
 

And what makes you think this is a mysql list?
--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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