>Thanks Tom that worked great.
Are you sure it gave what you wanted?
Because VFP doesn't enforce all ANSI-92 rules, you can get into trouble using GROUP BY.
You should find that the data actually being retrieved by the SQL statement is for records 2 and 3 not 1 and 3. This happens when extra fields are returned that are not part of an aggregate and are not included in the GROUP BY clause. VFP takes the values for the extra fields from the record located physically last in the table corresponding to the group.
I don't believe there is an easy way to do this using simple SQL. You have to process the records involved so VFP code is probably your best bet.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao