I want to comment further on Borislav's reply. Although Set Enginebehavior 70 will make your select statement work, you may very well end up with the wrong data. That's what you see, and that's why this was fixed in later versions of VFP. So NEVER have Set Enginebehavior 70 (or 80) in your working code, only use it until you have fixed your select statements.
For further information, see
http://fox.wikis.com/wc.dll?Wiki~EngineBehavior>I have following table
>
>REP COUNTRY SALES
>01 IRL 600
>01 UK 500
>01 USA 400
>02 FRA 300
>02 GER 200
>02 ITA 100
>
>Set Enginebehavior 70
>Select Rep,Country, *,Max(Sales) as MySales from MyTable Group by REP ..results in
>01 USA 400
>02 ITA 100
>
>It picks the Sales ok but country arbitrarily (I think)
>
>The country I want is the country on the row with the Highest Sale i.e.
>01 IRL 600
>02 FRA 300
>
>Is there any way in SQL to do this ??
>
>Tia
>Gerard