Hi Sergey.
Thanks for that.. I'll give it a go.
Regards,
Gerard
>Try
SELECT * ;
> FROM mytable mt1 ;
> WHERE date IN ( ;
> SELECT MAX(date) FROM mytable mt2 ;
> WHERE mt1.grp = mt2.grp) ;
> ORDER BY grp
>* or
>SELECT * ;
> FROM mytable ;
> WHERE grp + DTOS(date) IN ( ;
> SELECT grp + MAX(DTOS(date)) FROM mytable ;
> GROUP BY grp) ;
> ORDER BY grp
>
BTW, your expected result is incorrect for AA.
>
>>Is there a way to do an SQL statemrent to group as follows:
>>
>>File has 3 fields
>>
>>Grp Date Value
>>--- ---- -----
>>CC 19/01/04 87
>>CC 16/01/04 84
>>AA 20/01/04 20
>>AA 25/01/04 40
>>AA 22/01/04 60
>>BB 18/01/04 12
>>BB 16/01/04 89
>>BB 15/01/04 33
>>
>>I need to get The latest date for each group
>> So the following should be returned in order by Group, but just returning One group
>>
>>AA 25/01/04 20
>>BB 18/01/04 12
>>CC 19/01/04 87
>>