Django多表查询

tables = """
commend_intonetworkdata d,commend_intonetwork n
"""
wheresql = """
commend_intonetworkdata.ismatched=false and
commend_intonetwork.status!='success' and
trim(commend_intonetworkdata.phoneno)=trim(commend_intonetwork.phoneno) and
CAST(commend_intonetworkdata.createtime as date)=commend_intonetwork.saledate
"""

networks = IntoNetwork.objects.extra(select={'did':'commend_intonetworkdata.id'},tables=["commend_intonetworkdata","commend_intonetwork"],where=[wheresql])
好像不支持table as功能?

你可能感兴趣的:(django)