locked
help with lambda query RRS feed

  • Question

  • User-507786106 posted

    I have the query below and I need to have another && ( table2.field3 == _value)

    How can I add this to my expression? How can I add the above code into the query below?

    var results - (from  x in _db.Table1

    where ! _db.Table2.Any(f => f.Field3 == _id && (DbFunctions.TruncateTime(f.Created) == currentDateTime)

    && (x.title == _titname ) && (x.active== true)

    select (x)).ToList();

    Pseudo Code Example

    from table1 where _id &&  _value & currentDateTime is not in Table2 where (Table1.Title ==  _titlename) && (Table1.active == true)

    Monday, July 29, 2019 6:45 PM

Answers

  • User1724605321 posted

    Hi slimbunny,

    Try something like :

    where ! _db.Table2.Any(f => f.Field3 == _id &&f.field3 == _value&& (DbFunctions.TruncateTime(f.Created) == currentDateTime)

    Best Regards,

    Nan Yu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 30, 2019 2:31 AM