DenSter wrote:
SETCURRENTKEY should match the ORDER BY clause
SETFILTER/SETRANGE should match the WHERE clause, although there are some funky things going on there sometimes, where you see the same field filtered more than once.
I noticed it as well, I'm wondering why?
DenSter wrote:
If you have a SETCURRENTKEY on field 1 and 2, and you see an ORDER BY clause on two different fields, then you are not looking at the C/AL that generated the SQL.
i don't think i completely understood this statement, sorry...if I do
SETCURRENTKEY(field1,field2);
SETRANGE(field3,'A');
FINDSET;
just becase i'm dumb or i do really need to order my table like this...then WHERE and ORDER BY "does not match"...and it's C/AL code that generated the "bad" query
DenSter wrote:
Whether SQL Server actually uses a certain index or not doesn't affect the WHERE and ORDER BY clause.
But WHERE and ORDER BY (and thus SETCURRENTKEY, settableview, setrange/filter and similar) affect SQL in the index selection for the query, isn't it? this is where the problem arose in my case.
DenSter wrote:
If I remember correctly, Kriki (here on Mibuso) and Waldo (on his blog) both wrote a few detailed posts about the correlation between C/AL and the queries, see if you can find those.
And jorg as well in his book, page 101..103
