10-20-2006 10:08 AM
Hi,
I want to select the entire row which has the biggest name grouped by name and last.
But the thing is I want to select the entire row because i want to put the entire row into a structure and not just a few fields. In psedocode I want to do:
SELECT * WITH REGARDS TO MAX(Date)
FROM myTable
INTO myTable_Structure
GROUP BY name last.
How do I achieve this?
Name Last Date
Emil Larsson 200609
Emil Larsson 200611
Emil Larsson 200610
10-20-2006 10:51 AM
You can try to build a subquery in you select command, haven't tried this one but it could look as follows:
SELECT name lastname date up to 1 rows
INTO myTable_Structure
FROM myTable
where date eq ( select max( date ) from myTable ).
endselect.
10-20-2006 10:13 AM
Hi Baran,
u can even do this.
create a table with structure of ur table.
select * from
table
into table ur internal table
if sy-subrc = 0.
sort internal table by Name Last Date
endif.
Madhavi.
10-20-2006 10:19 AM
Baran,
As I understand it is in continuation of ur prev query...
I would say get the information for namelastnamemax(date) into internal table itab and use the below after that.
SELECT * into table itab1
from ztable
for all enteries in itab
where name = itab-name
and lastname = itab-lastname
and date = itab-date.
10-20-2006 10:22 AM
Hi
Just as I said in my answer in your previuos post, use ORDER BY option:
SELECT * FROM ZTABLE INTO myTable_Structure
ORDER BY DATE.
Max
10-20-2006 10:51 AM
You can try to build a subquery in you select command, haven't tried this one but it could look as follows:
SELECT name lastname date up to 1 rows
INTO myTable_Structure
FROM myTable
where date eq ( select max( date ) from myTable ).
endselect.