>
>>If there is more than one record in the result set, then there is more that one category+id_field combination that has that MIN(mynumber).
>
> Actually this will not help, because what if we need to select all categories? There is solution, however, that is not efficient, using sub-query.
Right.
>(IMHO VFP query in such case MUCH more efficient).
The point is this: If you don't GROUP BY category and id, the ID you get back is meaningless, since it will be the last ID in the table - which will not necessarily be an id that goes with the MIN() value.
e.g.
Category ID MyNumber
----------------------------
One 1 3
One 2 4
One 3 3
One 4 3
One 5 5
SELECT category, id, MIN(mynumber) as mynumber ;
FROM mytable ;
GROUP BY category ;
INTO CURSOR cutmp
Category ID MyNumber
----------------------------
One 5 3
Insanity: Doing the same thing over and over and expecting different results.