0

i been given a SQL inner join with OR condition, could someone help to convert into linq? Below is LINQ that i've converted except the "OR" condition

SQL

SELECT Msg.IntMsg
FROM CRM_MsgTbl Msg
    INNER JOIN CRM_TargetCustTbl TCust ON Msg.intCRM = TCust.intCRM
    INNER JOIN Cust_GroupDetailTbl CustGD ON TCust.intCustGroup = CustGD.intCustGroup
    INNER JOIN Cust_ProfileTbl
    ON  (Cust.bintAccountNo = CustGD.bintAccountNo OR TCust.intCustGroup=0) --How to convert this line to LINQ

LINQ

from Msg in db.CRM_MsgTbl
join TCust in CRM_TargetCustTbl on Msg.intCRM equals TCust.intCRM
join CustGD in Cust_GroupDetailTbl on TCust.intCustGroup equals CustGD.intCustGroup
join Cust in Cust_ProfileTbl on CustGD.bintAccountNo equals Cust.bintAccountNo
select new {
  intMsg = Msg.intMsg
} 
4

1 回答 1

0

这个怎么样?

from Msg in db.CRM_MsgTbl
join TCust in CRM_TargetCustTbl on Msg.intCRM equals TCust.intCRM
join CustGD in Cust_GroupDetailTbl on TCust.intCustGroup equals CustGD.intCustGroup
from Cust in Cust_ProfileTbl
where CustGD.bintAccountNo = Cust.bintAccountNo or TCust.intCustGroup = 0
select Msg.intMsg
于 2013-10-01T02:44:38.177 回答