The code, with two Linq-to-SQL queries, that I am trying to optimize is below:
var maxAInstant = ( from a in db.As select a.Instant ) .Max(); var maxBInstant = ( from b in db.Bs select b.instant ) .Max(); var interval = maxAInstant - maxBInstant; bool result = interval > new TimeSpan(0, 0, 1);
Can I obtain the result with a single Linq-to-SQL query?
Try this: