Hello,
recently I got quite interesting problem. We have a case when we select from one table, but do filtering and sorting by values in another table.
I noticed that if query has sorting with column which is not in select result set - sorting is performed in memory and Limit is not added to the query.
I traced down the responsible code which is DynamicQueryEngineBase.cs method HandleDistinctEmit. It even has comment: // check if the sortclause fields are in the selectlist.
Is this correct? Do I do something wrong about this? In sql sorting and filtering by field which is not in select list works fine, not sure why you do this in the framework?
If I add my sort field to select list, limit is added without problems.
regards
Mantas