i need to do this query:
SELECT *
FROM tbl_member
WHERE (member_type==1 AND member_status==1)
OR (member_type==2 and member_status==2)
i've tried:
q=session.query(tbl_member) \
.filter(or_(and_(tbl_member.member_type==1,tbl_member.member_status==1), \
and_(tbl_member.member_type==2,tbl_member.member_status==2)))
and
q=session.query(tbl_member) \
.filter(or_((and_(tbl_member.member_type==1,tbl_member.member_status==1)), \
(and_(tbl_member.member_type==2,tbl_member.member_status==2))))
the query sql still like this:
SELECT *
FROM tbl_member
WHERE member_type==1 AND member_status==1 OR member_type==2 AND member_status==2
how should i do?
AND
taking precedence overOR
. – Shaff