Aniket Narvankar

Aniket Narvankar

  • 564
  • 2.1k
  • 604.2k

Converting Sql Query to Linq

Jan 4 2022 8:09 AM

    Update tbl1 SET tbl1.CoAppEmailAddress = tbl2.PhoneValue From tbl1, tbl3, tbl2 Where tbl3.LeadId = tbl2.EntityContactID AND tbl1.RefNumber = tbl3.ReferenceNbr AND tbl2.PhoneType in ('CoApp Email', 'Email') AND((tbl2.EDDFlag = 0 OR tbl2.EDDFlag is NULL) AND EXISTS(Select 1 from tbl2 where tbl2.EntityContactID = tbl3.LeadId and tbl2.EDDFlag = 1)) and tbl1.LeadId = @LeadId 
        
        
    This query is setting CoAppEmailAddress base on some condition,want to rewrite this query using linq in c sharp,have to taken tbl2 values in list
    List<tbl2> lsttbl2,this list contains tbl2 columns PhoneValue,EDDFlag,EntityContactID,PhoneType but not understanding how to proceed further


Answers (1)