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

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -