Re: Multiple addJoin with OR
Thomas Vandahl <[email protected]> Mon, 02 Mar 2009 21:35:12 +0100
| Newsgroups | gmane.comp.jakarta.turbine.torque.user |
|---|---|
| Message-ID | <[email protected]> |
Ludwig Magnusson wrote: > It does make sense. I rewrote the query by hand (changed AND to OR) and > executed it in the MySql console and it gave the response I wanted. I still suspect that this is error prone. I'd be interested in the output of "explain". > The situation is kind of like this: > Table a is a category table, it only contains ids and names of categories. > Table B is a "products sold" table, and table C is a "products bought" > table. All products belong to a certain category, and I want a query that > gives me all the categories that a certain user has sold/bought products > from. I'd suggest to right join table b to a, left join table a to c, check for not null and be sure to set distinct (you did that anyway, didn't you?) Bye, Thomas.