c# Linq left join 多个条件连接查询如下面的sql 用查询表达式怎么写?SELECT A.*,B.ITEM_NAME AS MoneyType_DESC,C.ITEM_NAME AS PayMentType_DESC,D.ITEM_NAME AS ApplyType_DESC FROM DFZFORMT055 A LEFT JOIN FM_CODE_LIST B ON A.MoneyType =

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 13:07:59
c#Linqleftjoin多个条件连接查询如下面的sql用查询表达式怎么写?SELECTA.*,B.ITEM_NAMEASMoneyType_DESC,C.ITEM_NAMEASPayMentTyp

c# Linq left join 多个条件连接查询如下面的sql 用查询表达式怎么写?SELECT A.*,B.ITEM_NAME AS MoneyType_DESC,C.ITEM_NAME AS PayMentType_DESC,D.ITEM_NAME AS ApplyType_DESC FROM DFZFORMT055 A LEFT JOIN FM_CODE_LIST B ON A.MoneyType =
c# Linq left join 多个条件连接查询
如下面的sql 用查询表达式怎么写?
SELECT A.*,B.ITEM_NAME AS MoneyType_DESC,C.ITEM_NAME AS PayMentType_DESC,D.ITEM_NAME AS ApplyType_DESC
FROM DFZFORMT055 A
LEFT JOIN FM_CODE_LIST B ON A.MoneyType = B.ITEM_VALUE AND B.FORM_KIND = 'DFZ.FORM.T055' AND B.FIELD_NAME= 'MoneyType'
LEFT JOIN FM_CODE_LIST C ON A.PayMentType = C.ITEM_VALUE AND C.FORM_KIND = 'DFZ.FORM.T055' AND C.FIELD_NAME= 'PayMentType'
LEFT JOIN FM_CODE_LIST D ON A.APPLYTYPE = D.ITEM_VALUE AND D.FORM_KIND = 'DFZ.FORM.T055' AND D.FIELD_NAME= 'ApplyType'
WHERE A.form_no=9
自己搞定了,还是要谢谢 w362435819和 fansui1983
var query = from MainTable in T055
join B in (from codelist in CODELIST where codelist.FORM_KIND=="DFZ.FORM.T055" &&codelist.ITEM_NAME=="MoneyType" select codelist)
on MainTable.MoneyType equals B.ITEM_VALUE into B_Join
from BB in B_Join.DefaultIfEmpty()
join C in (from codelist in CODELIST2 where codelist.FORM_KIND == "DFZ.FORM.T055" && codelist.ITEM_NAME == "PayMentType" select codelist)
on MainTable.PayMentType equals C.ITEM_VALUE into C_Join
from CC in C_Join.DefaultIfEmpty()
join D in .
where MainTable.FORM_NO == m_intFormNo

c# Linq left join 多个条件连接查询如下面的sql 用查询表达式怎么写?SELECT A.*,B.ITEM_NAME AS MoneyType_DESC,C.ITEM_NAME AS PayMentType_DESC,D.ITEM_NAME AS ApplyType_DESC FROM DFZFORMT055 A LEFT JOIN FM_CODE_LIST B ON A.MoneyType =
from A in DFZFORMT055 join B in FM_CODE_LIST on
A.MoneyType = B.ITEM_VALUE AND B.FORM_KIND = 'DFZ.FORM.T055' AND B.FIELD_NAME= 'MoneyType'
join C in JOIN FM_CODE_LIST on
A.PayMentType = C.ITEM_VALUE AND C.FORM_KIND = 'DFZ.FORM.T055' AND C.FIELD_NAME= 'PayMentType'
join D in FM_CODE_LIST on
A.APPLYTYPE = D.ITEM_VALUE AND D.FORM_KIND = 'DFZ.FORM.T055' AND D.FIELD_NAME= 'ApplyType'
where A.form_no=9
select A