我需要做这个查询:
SELECT *
FROM tbl_member
WHERE (member_type==1 AND member_status==1)
OR (member_type==2 and member_status==2)
我试过了:
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)))
和
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))))
查询sql还是这样的:
SELECT *
FROM tbl_member
WHERE member_type==1 AND member_status==1 OR member_type==2 AND member_status==2
我应该怎么做?