c# - Filtering results based on date and fetching one previous value -


i have idbset querying following:

var list = messageset.where(x => x.date >= fromdate && x.date <= todate); 

later on other linq queries such select, orderby , on.

in order calculate , transform data in way want, need last value before fromdate, can obtain as:

var prevvalue = messageset.where(x => x.date < fromdate).orderbydescending(x => x.date).firstordefault(); 

however, doing join iqueryable, not working me

is there way combine queries?

can union entries between dates , 1 before?

var list = messageset.where(x => x.date >= fromdate && x.date <= todate)                      .union(messageset                             .where(x=>x.date < fromdate).orderbydescending(x=>x.date).take(1)     ); 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -