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

Select with Max

Former Member
0 Likes
381

Hi Abap Gurus,

I am facing a apparently simple question but i can not found the answer

I need to select the maximum year and then select the maximum month

for exemple matnr year month

                   b-12  2012   2

                   b-12  2012   3

                   b-11  2011   7

I want to get

                  b-12  2012   3

                  b-11  2011   7

How can i get this using select max?

Or do you have another purpose?

            Thank You and Best Regards

                       João Fernandes

2 REPLIES 2
Read only

hendrik_brandes
Contributor
0 Likes
340

Hello Joao,

I would try to use "GROUP BY":

SELECT matnr MAX( year ) MAX( MONTH ) FROM ztable

  WHERE ...

  GROUP BY matnr fiscyear month.

Kind regards,

Hendrik

Read only

Former Member
0 Likes
340

select max( ERSDA ) from mara upto 2 rows.

where "your where condition.

will select any no of rows u want.