10-20-2006 9:22 AM
Hi,
I have a table with 3 columns. The table looks like the example below. There can be same persons with different dates.
I want to withoud using for loops, just using select statement pick out Emil Larsson with the biggest date, that is the most recent date up to today. How do you achieve this with select statements?
Name LastName Date
John Larsson 20061001
Emil Larsson 20060927
John Larsson 20061006
Emil Larsson 20061018
regards
Baran
10-20-2006 9:25 AM
SELECT Name LastName Max(Date) into table itab
from ztable
group by name lastname.
After the execution of the above query you would have the records in internal table itab for each unique name+lastname with the latest date.
Message was edited by: Anurag Bankley
10-20-2006 9:25 AM
SELECT Name LastName Max(Date) into table itab
from ztable
group by name lastname.
After the execution of the above query you would have the records in internal table itab for each unique name+lastname with the latest date.
Message was edited by: Anurag Bankley
10-20-2006 9:27 AM
Hi
SELECT * FROM ZTABLE WHERE NAME = 'EMIL'
AND LASTNAME = 'LARSON'
ORDER BY DATE DESCENDING.
EXIT.
ENDSELECT.
Max