db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vandahl ...@apache.org>
Subject Re: Multiple addJoin with OR
Date Mon, 02 Mar 2009 20:35:12 GMT
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.

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message