On Mar 25, 2013, at 1:54 AM, Michal Nowikowski <godf...@gmail.com> wrote:

> I got to the point where proper raw SQL query looks as follows:
> 
> SELECT 
>   A.id AS a_id,
>   B_1.id AS b1_id, 
>   B_2.id AS b2_id,  
> FROM 
>   A
> LEFT OUTER JOIN   B AS B_1  ON A.id = B_1.a_id AND B_1.c_id = 66
> LEFT OUTER JOIN   B AS B_2  ON A.id = B_2.a_id AND B_2.c_id = 70
> WHERE
>   B_1.id is not NULL or 
>   B_2.id is not NULL;
> Now, do you know how to get this coded either in ORM query or SA SQL 
> expressions?
> 
> 

the ORM tutorial has an example for joining to aliased tables that is nearly 
identical in structure to this query:

http://docs.sqlalchemy.org/en/rel_0_8/orm/tutorial.html#using-aliases

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to