But wouldn't the join from orders to items be OUTER in this case since you can have orders with a total > 50 but no items. (Your application logic probably forbids this, but it is allowed at the relational level).
Gets complicated quick! On Nov 10, 2006, at 12:13 AM, Daniel Miller wrote: > q.select(and_( > c.orders.order_total > 50, > or_( > c.orders.items.item_name == 'item #4', > c.orders.items.item_name == 'item #5', > ) > )) > > SELECT ... > FROM users u > INNER JOIN orders o > ON u.user_id = o.user_id > INNER JOIN items i > ON o.order_id = i.order_id > WHERE o.order_total > 50 AND > ( > i.item_name = 'item#4' OR > i.item_name = 'item #5' > ) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---