Skip to content

Instantly share code, notes, and snippets.

@meau
Created February 16, 2016 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meau/7fb8995530375f3941ee to your computer and use it in GitHub Desktop.
Save meau/7fb8995530375f3941ee to your computer and use it in GitHub Desktop.
SELECT
CONCAT('/resources/', r.id) 'resource URL',
repo.repo_code,
r.identifier,
r.title,
cm.processing_hours_per_foot_estimate,
cm.processing_total_extent,
cm.processing_hours_total,
cm.processing_plan,
pp.value 'processing priority',
ps.value 'processing status',
cm.processing_funding_source,
cm.processors,
eti.value 'event type',
outcome.value 'event outcome',
r.last_modified_by,
r.system_mtime,
r.created_by,
r.create_time
FROM
resource r
LEFT JOIN
collection_management cm ON cm.resource_id = r.id
LEFT JOIN
event_link_rlshp elr ON elr.resource_id = r.id
LEFT JOIN
event e ON elr.event_id = e.id
LEFT JOIN
enumeration_value pp ON cm.processing_priority_id = pp.id
LEFT JOIN
enumeration_value ps ON cm.processing_status_id = ps.id
LEFT JOIN
enumeration_value eti ON e.event_type_id = eti.id
LEFT JOIN
enumeration_value outcome ON e.outcome_id = outcome.id
LEFT JOIN
repository repo ON r.repo_id = repo.id
WHERE (cm.id IS NOT NULL OR e.id IS NOT NULL)
ORDER BY r.repo_id , r.last_modified_by;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment