“Order by” is not working as I expect in this query:
All looks good, and the query compiles properly, but when I run the query through a view, the query ignores these fields and the records are not sorted.
As you can see the fileds placed in “Order by” are from child tables, I wondering if this is the root cause of my problem,
Anyone have idea whats going on with this?
No, there is nothing wrong with “order by” in AOT queries.
Your problem is caused by the view. Unfortunately, the ordering is ignored by views and this behavior is documented on MSDN. View Basics says: Do not specify a field in the Order By element. A view cannot use the field information in the Order By element.
Thank you for the clarification
If my reply answered your question, please mark it as the verified answer.