| index

View V_LATEST_RT_CODE_FOR_ENRO

Columns

Name | Type | Optional | Default | Comments
PRTY_ID | NUMBER |  |  |
RT_CODE | VARCHAR2(80) |  |  |
START_DATE | DATE |  |  |
END_DATE | DATE | Y |  |
ENQU_ID | NUMBER |  |  |

SQL

    CREATE OR REPLACE VIEW V_LATEST_RT_CODE_FOR_ENRO AS
    SELECT prty_id
          ,rt_code
          ,start_date
          ,end_date
          ,enqu_id
      FROM (SELECT enro.*
                  ,MAX(start_date) over(PARTITION BY rt_code, enqu_id) AS max_date_rt_code
              FROM enquiry_roles enro)
     WHERE start_date = max_date_rt_code;