I have currently been trying to convert the query string/code below to a SQL query.
If anyone can decode the query, I would be grateful.
AtrDataContext orion = new AtrDataContext();
MasterCalculator dcc = (from a in orion.MasterCalculator
where DaysOld >= a.startDayRange
&& (!a.endDayRange.HasValue || DaysOld <= a.endDayRange)
The HasValue is just a null checker. DaysOld seems like it is a variable passed in. Something like this...
SELECT TOP 1 * FROM MasterCalculator a WHERE a.startDayRange <= @DaysOld AND (a.endDayRange == NULL OR a.endDayRange >= @DaysOld)
Of course, good practice is to specify each of the columns