Hi Everyone,

I got excited when I discovered subselects, but quickly discovered that 4.1
is still in gamma and I can't put it onto my production server.  The query I
wanted to use would be great, so maybe there's a way to convert it - since
the manual says most subselects can be done with joins.  I'm not sure how
I'd do it though and figured I'd see if anyone here knows how.

Here's the subselect that I'd like to use:

select ID from products where CategoryID = (select ID from categories where
ID='21' OR ParentID = '21' )

How would I would I create a query using joins that accomplishes the same
result?

Here's what I was attempting, in case it's close, but it's erroring out:

select ID from products right join categories where (categories.ID = '21' or
categories.ParentID='21') AND (products.CategoryID = categories.ID or
products.CategoryID = categories.ParentID)

Thanks,

Ed


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to