Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE VIEW V_CAM_FILE_LINK_NEWEST_DOC_VERSION AS
- SELECT
- cr.cam_id,
- cr.cam_header_id,
- cr.cam_num,
- cr.modification_num,
- cf.file_link_id,
- cf.link_id,
- cf.title,
- cf.description,
- cf.appian_document_id,
- cf.version_num,
- cf.type_id,
- co.option_name,
- co.signature_required,
- cr.agreement_appian_folder_id,
- cr.modification_appian_folder_id,
- cf.signed,
- cf.signed_by,
- cf.signed_date,
- cf.file_id,
- cf.file_type,
- cf.file_locked,
- cf.checkout_by,
- cf.checkoutdate,
- cf.checkin_by,
- cf.checkindate,
- cf.created_by,
- cf.created_date,
- ROW_NUMBER() OVER (PARTITION BY cf.link_id ORDER BY cf.version_num DESC) AS “row_num”
- FROM cam_records cr JOIN cam_file_link cf ON cr.cam_id = cf.cam_id
- LEFT JOIN cam_options co ON cf.type_id = co.option_id
- WHERE row_num = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement