‎2008 Aug 29 8:39 AM
I have a table with composite primary key as follows
Field 1 Field2
AAA 01
AAA 02
AAA 03
BBB 01
BBB 02
Now I want to select records with max(field2) for a given field1, ie
AAA 03
BBB 02
One way would be to kae it eo an internal table sort by second column descending and take the first record, is there a more elegant way using the MAX clause of the open SQL
‎2008 Aug 29 8:49 AM
‎2008 Aug 29 8:51 AM
hii
you can use query like
Select MAX(VERSION) from ztable into temp1
where OBJECT = temp1
group by version
ordey by version descending.regards
twinkal
‎2008 Aug 29 8:58 AM
‎2008 Aug 29 12:08 PM
hi
select the data from database and put it into Internal table first
then
sort itab field1 field2 by descending
loop at itab.
at new
end at
endloop
Regards
Deva