SQL查询转换为Linq

时间:2019-11-08 09:27:14

标签: sql-server linq c#-4.0

如何将此SQL语句转换为linq?

SELECT 
    ICRE.CampaignID,
    MAX(ICRE.CampaignsRegularEvaluaterID) AS CampaignsRegularEvaluaterID,
    MAX(ICC.Name) AS CampaingName
FROM
    INN_Customers_Campaigns_EvaluationStage ICCES
INNER JOIN 
    INN_Campaigns_RegularEvaluaters ICRE ON ICRE.CampaignsEvaluationStageID = ICCES.Id
INNER JOIN 
    INN_Customers_Campaingns ICC ON ICC.Id = ICCES.CampaignId
INNER JOIN 
    INN_Customers_Teams t ON t.Id = ICRE.RegularEvaluaterID
LEFT JOIN 
    INN_Customers_Campaigns_EvaluationStage ICCES1 ON ICCES1.CampaignId = ICCES.CampaignId
WHERE 
    ICRE.RegularEvaluaterID = @userid
    AND ICCES1.Sequence IS NOT NULL
    AND ICRE.IsEvaluated IS NOT NULL
GROUP BY 
    ICRE.CampaignID;

0 个答案:

没有答案