/*****************************************************************************
*
* Filename         - $Workfile:   flights_linked_v2.sql  $
*
*                     Name              Date      Version     CR Number
* Author           - See revision history below.
* Last Update      - See revision history below.
*
* Project Name     - TAGTRAK(Oracle database)
*
* Source Code
* Identifier       - 0/3/300/8010/112
*
* Design Spec
* Section          -
*
* Contents         - Live schema view
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/
CREATE OR REPLACE FORCE VIEW flights_linked_v2
(
        agent_code,
        in_flight_id,
        out_flight_id
) aS
(SELECT fao.agent_code,
        fl.in_flight_id,
        fl.out_flight_id
FROM    flights_linked_v1 fl,
        flight_access fai,
        flight_access fao
WHERE   fai.flight_id = fl.in_flight_id
  AND   fao.flight_id = fl.out_flight_id
  AND   fai.agent_code = fao.agent_code);
/

