Application Development and Automation 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: 
Read only

simple select query..

Former Member
0 Likes
779

Hi All,

Please tell me how can i fetch a single record having maximum value for a particular column ( aggregate function MAX ).

assume that the table name = T1 and column name = C1

Thanks in Advance, Sudeep..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
762

Select MAX(C1)

into var_c1

from T1

where <your condition>.

regards

Nishant

5 REPLIES 5
Read only

Former Member
0 Likes
763

Select MAX(C1)

into var_c1

from T1

where <your condition>.

regards

Nishant

Read only

0 Likes
762

Thanks..

Read only

Former Member
0 Likes
762

tables T1.

data tvbak like vbak-vbeln.

Select max( C1 )

from T1 into tvbak.

write tvbak.

Read only

Former Member
0 Likes
762

data: it_table type T1.

SELECT single * FROM T1

INTO TABLE it_table

WHERE C1 = ( SELECT MAX( C1 ) FROM T1 ).

LOOP AT it_table.

WRITE: it_table-C1.

ENDLOOP.

Award points if found useful

Read only

Former Member
0 Likes
762

Select MAX(C1)

into var_c1

from T1

where <your condition>

GROUP BY C1.

This will work..

Reward points if it helps