>>Never mind. If I remove TOP 180, it still returns just 48 records. Weird.
>
>After I fixed some program, it now returns 220 instead of 180. I forgot what is the condition when SELECT TOP N returns more records when requested.
If the 180..220 have the same ORDER BY values.
>Is it the same behavior in VFP9?
No it return 180, as in MS SQL.
Then the result can to be not fully deterministic.
BUT !!
TOP N PERCENT cannot be optimized unless the whole result set can be read into memory at once.
>
>Thanks in advance.