Strange mysql/pear db self join help needed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Can someone answer a MySQL question for me?  I'm trying to do a self join on
my category table and I'm only coming up with 2 fields in my recordset when
I know I should have 5 fields. Here is the code I'm using. 

>SELECT Cats3.CatId, Cats.Cat, Cats1.Cat, Cats2.Cat, Cats3.Cat 
>FROM (((Cats As Cats3 left JOIN Cats As Cats2 ON Cats3.ParentId =
Cats2.CatId)
>LEFT JOIN Cats As Cats1 ON Cats2.ParentId = Cats1.CatId) 
>LEFT JOIN Cats As Cats ON Cats1.ParentId = Cats.CatId) 
>WHERE Cats3.CatTypeId = 2 AND Cats.ParentId is NULL 
>ORDER BY (Cats.Cat + Cats1.Cat + Cats2.Cat + Cats3.Cat)


When I execute this query in something like Navcat 2005 or SQLyog it works
fine.  By the way, I'm also using the PEAR DB class.

Any ideas?

Thanks  :)

Jim MacDiarmid

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux