Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. CREATE OR REPLACE VIEW V_CAM_FILE_LINK_NEWEST_DOC_VERSION AS
  2. SELECT
  3. cr.cam_id,
  4. cr.cam_header_id,
  5. cr.cam_num,
  6. cr.modification_num,
  7. cf.file_link_id,
  8. cf.link_id,
  9. cf.title,
  10. cf.description,
  11. cf.appian_document_id,
  12. cf.version_num,
  13. cf.type_id,
  14. co.option_name,
  15. co.signature_required,
  16. cr.agreement_appian_folder_id,
  17. cr.modification_appian_folder_id,
  18. cf.signed,
  19. cf.signed_by,
  20. cf.signed_date,
  21. cf.file_id,
  22. cf.file_type,
  23. cf.file_locked,
  24. cf.checkout_by,
  25. cf.checkoutdate,
  26. cf.checkin_by,
  27. cf.checkindate,
  28. cf.created_by,
  29. cf.created_date,
  30. ROW_NUMBER() OVER (PARTITION BY cf.link_id ORDER BY cf.version_num DESC) AS “row_num”
  31.  
  32. FROM cam_records cr JOIN cam_file_link cf ON cr.cam_id = cf.cam_id
  33. LEFT JOIN cam_options co ON cf.type_id = co.option_id
  34.  
  35. WHERE row_num = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement