First off, that's not an in
, that's an =
since max()
returns a single element. Also your sql query has lwp
in the where
clause, you probably typo'd id
. With that in mind, what you want is something like:
.Where(row=>row.ID=Entitydb.lwpmethod.GetList()
.Where(r=>r.ordid=row.ordid)
.Max(r=>r.ID))
C# code, but you get the idea.
By the way this looks like it's selecting the last row. Why not just sort by id
descendently and take the first element?