I am using BLToolkit and find out an interesting behaviour. I don't understand why using the same request in link give me different results: SQL request:
select TOP 1 * from table where coverCode='1+4'
and effectiveDate <='20130103'
and maxValue >= '1000'
order by maxValue asc, effectivedate desc
this table actually has two results:
A) (id): 1ffbe215-ff0e-47dd-9718-4130ffb62539 (maxValue): 1000 (effDate):2011-01-01 (price):40
B) (id): b787a74e-696b-493d-a4bc-5bb407e231b3 (maxValue):1000 (effDate):2011-01-01 (price):80
and SQL request gives me the A result. and at the same time the request using Linq:
db.Rate
.Where(x=>x.coverCode == "1+4"
&& x.effectiveDate <= '20130103'
&& x.MaxValue >= '1000')
.OrderBy(x => x.MaxValue)
.ThenByDescending(x => x.effectiveDate)
This request gives me the B result. Can anyone explain why or what is wrong in the linq request?