Skip to Content
avatar image
Former Member

select

how to select recent date record in a table

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Aug 20, 2007 at 08:37 AM

    select * from table-name where date = max(date)

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 08:40 AM

    Hi Pandu,

    First select all the entries into itab, Then sort it by timestamp in descending order,

    then delete the entries other than first occurance.

    Code,

    SORT ITAB BY FIELD1 ASCENDING TIMESTMP DESCENDING.

    READ TABLE ITAB INTO WA_ITAB.

    LOOP AT ITAB.

    IF WA_ITAB-FIELD1 = ITAB-FIELD1 AND SY-TABIX NE 1.

    DELETE ITAB INDEX SY-TABIX.

    ELSE.

    MOVE ITAB TO WA_ITAB.

    ENDIF.

    ENDLOOP.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 20, 2007 at 08:40 AM

    hi,

    u have select data based on some field.

    that may be date (if date field is there),or somthing else.

    You cant select recent data without any specific field. So search for that option.

    Add comment
    10|10000 characters needed characters exceeded