c# - add MAX to existing criteria in LINQ query -
i have folowing query pulls item list.
latestdoc = opendocs.where(d => d.docbatchid == hard_coded_id).firstordefault();
i want find row lateststatusdate...i'm using max function returns null, believe max looking max of all docs, want find max of docs contain batchid
latestdoc = opendocs.where(d => d.docbatchid == hard_coded_id && d.prodstatus == opendocs.max(d => d.prodstatus)).firstordefault();
any ideas?
ta, yogi
you can use orderbydescending
:
latestdoc = opendocs.where(d => d.docbatchid == hard_coded_id) .orderbydescending(d => d.statusdate) .firstordefault();
Comments
Post a Comment