>>It's documented change in the SQL Engine behavior: ORDER BY clause cannot include field that it's not in the field list if DISTINCT is used. You can add OrderMain to the field list.
SELECT DISTINCT Numero, OrderMain FROM Temp ORDER BY OrderMain INTO CURSOR Temp2
>
>By doing this, I have no bug. But, the SQL result is double and that fakes the result I need to achieve.
Woud this work?
<pre>SELECT Numero, MAX(OrderMain) SortOrd FROM Temp ;
GROUP BY Numero ;
ORDER BY SortOrd ;
INTO CURSOR Temp2
If it doesn't, can you provide more info about data you're processing and result you want.
--sb--