Skip to Content
author's profile photo Former Member
Former Member

Maximum Value of a filed

Hi! Friends

Is there any possibilities to fetch maximum value of a filed using where condition.

I have to fetch the latest revision date from the given date. i,e, Ex: Input Date - 08.09.2009 and need to display the order which are having their latest revision date as 08.09.2009 based on these orders need to fetch the other details.

Thanks,

Kv

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 08, 2009 at 03:36 AM

    Press F1 on MAX and check. You can use this in Select statement directly.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 08, 2009 at 04:42 AM

    You can fetch the max value in the select statement itself.

    Example:

    SELECT MAX( eindt ) FROM eket

    INTO gv_eindt

    WHERE ebeln = gv_ebeln AND

    ebelp = gv_ebelp.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 08, 2009 at 05:31 AM
    select *
    from table1 as o
    where eindt = ( select max( eindt )
                              from table1 as i
                              where eindt <= given_date 
                              and     o~key1 = i~key1
                              and     o~key2  = i~key2
                           )
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.