Skip to main content

To join these 2 tables I use the fields "MANDT" and "AUFNR".

In the table B, there can be several dates for the same order (AUFNR) and in table A I want to have only the most recent date for the order.

So I tried the formula LAST(table.date ORDER BY table.date ASC) but it did not work.

 

CREATE VIEW PP_QALS AS (

  SELECT DISTINCT

    "QALS".*,

    LAST("AFRU"."IEDD", ORDER BY "AFRU"."IEDD" ASC) AS AFRU_IEDD,

  FROM QALS_U_PP AS QALS

  LEFT JOIN "AFRU_U_PP_TEMP" AS AFRU ON 1=1

    AND "AFRU"."MANDT" = "QALS"."MANDANT"

    AND "AFRU"."AUFNR" = "QALS"."AUFNR"

),

 

Do you know how I can add this date field in table A ?

 

@lovise.helln​ (FYI)

Table A = QALS / Table B = AFRU


Reply