Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

duplicate max values

Former Member
0 Kudos

Hallo

i'm doing a select for a max-value in a column of a table. i'm getting the highest value exists twice (in two rows) and the rc that i get is 4. how can i get both rows in an internal table? or can i specify more tahn 1 column to find only one max-value.

the first column is a date, the second i could use would be a time-field.

my select-statement:

SELECT * FROM yvtebstg

INTO CORRESPONDING FIELDS OF TABLE lt_ebstg

WHERE polnr = ls_vermitt-polnr

AND temudat = ( select MAX( temudat ) FROM yvtebstg ).

many thanks, martin.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Why dont u use SELECT .....DESCENDING..

This will give u all the entries satisfying the condition & then u can delete all but one entries..

second method is to use SELECT UP TO 1 ROWS....DESCENDING.

Check out F1 help on SELECT statement..

2 REPLIES 2

Former Member
0 Kudos

Why dont u use SELECT .....DESCENDING..

This will give u all the entries satisfying the condition & then u can delete all but one entries..

second method is to use SELECT UP TO 1 ROWS....DESCENDING.

Check out F1 help on SELECT statement..

0 Kudos

Thank you very much.

Martin