亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

誰能提供 linq 查詢

誰能提供 linq 查詢

C#
慕工程0101907 2021-08-22 15:46:15
現在我想LINQ查詢,如果像以下compIds是0001或技術,然后我可以檢查與條件divisionCode ,如果compIds是0005或0006則不需要檢查與divisionCode這樣任何人都可以提供suggetioncompId可能增加取決于需求string[] compID = new string[] { "0002", "0001", "0005", "0006" };string[] divisionCode = new string[] { "01021159", "02013350", "02013483", "02013804", "02013375", "02013374", "02013380", "02013398", "02017379", "02013391", "02013444", "02013353", "02004458", "02013394" };var ACM = (from t1 in Entity.ApprovedContracts          join t2 in Entity.ApprovedResources          on t1.ApprovedResourceId equals t2.ResourceGeneralId          where compID.Contains(t1.OpuCode) && divisionCode.Contains(t1.DivisionCode)          select new          {                t1.OpuCode,                t1.DivisionCode,                t2.EnterpriseId,                t2.ResourceEmail          }).ToList();here
查看完整描述

2 回答

?
白板的微信

TA貢獻1883條經驗 獲得超3個贊

我認為只需要添加更多條件......應該是這樣的......


string[] compID = new string[] { "0002", "0001", "0005", "0006" };

string[] divisionCode = new string[] { "01021159", "02013350", "02013483", "02013804", "02013375", "02013374", "02013380", "02013398", "02017379", "02013391", "02013444", "02013353", "02004458", "02013394" };

var ACM = (from t1 in Entity.ApprovedContracts

      join t2 in Entity.ApprovedResources

      on t1.ApprovedResourceId equals t2.ResourceGeneralId

      where compID.Contains(t1.OpuCode) && (t1.OpuCode == "0005" || t1.OpuCode == "0006" || divisionCode.Contains(t1.DivisionCode)

      select new

      {

            t1.OpuCode,

            t1.DivisionCode,

            t2.EnterpriseId,

            t2.ResourceEmail

      }).ToList();


查看完整回答
反對 回復 2021-08-22
  • 2 回答
  • 0 關注
  • 189 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號