Hi all,

Suppose I have two tables t1 and t2 defined as following declarative
classes.
There is no foreign key setup in database between these two tables and
I want to write the join statement in sqlalchemy format which equates
to sql like this:

select t1.c11, t1.c12, t2.c23
from t1 join t2
on t1.c11==t2.c21 and
     t1.c12==t2.c22 and
     t2.c24 > xx;

Anyone could inform me how to achieve this?

class T1(object):

    __tablename__ = 't1'

    _id = Column('id', Integer, primary_key = True)
    c11 = Column('c11', Integer)
    c12 = Column('c12', Integer)


class T2(object):

    __tablename__ = 't2'

    _id = Column('id', Integer, primary_key = True)
    c21 = Column('c21', Integer)
    c22 = Column('c22', Integer)
    c23 = Column('c23', Integer)
    c24 = Column('c24', Integer)

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to