Skip to content

Instantly share code, notes, and snippets.

@fordmadox
Last active February 26, 2019 15:27
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 fordmadox/ebb36454bcbcca6f0dfff5829c948506 to your computer and use it in GitHub Desktop.
Save fordmadox/ebb36454bcbcca6f0dfff5829c948506 to your computer and use it in GitHub Desktop.
Sample ASpace SQL query to get Resource information and their extent statements
SELECT
r.id AS 'resource database id',
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(r.identifier, ',', '.'),'"',''),']',''),'[',''),'.null','') AS 'collection call number',
r.title,
r.publish,
r.repo_id,
r.ead_id,
r.finding_aid_author,
GROUP_CONCAT(DISTINCT extent.number, ' ', ev.value
SEPARATOR '; ') AS 'Extent',
GROUP_CONCAT(DISTINCT extent.container_summary
SEPARATOR '; ') AS 'Additional Extent',
GROUP_CONCAT(DISTINCT extent.dimensions
SEPARATOR '; ') AS 'Extent Dimensions',
GROUP_CONCAT(DISTINCT extent.physical_details
SEPARATOR '; ') AS 'Physical Details'
FROM
resource r
LEFT JOIN
extent ON extent.resource_id = r.id
LEFT JOIN
enumeration_value ev ON extent.extent_type_id = ev.id
GROUP BY r.id
ORDER BY r.ead_id
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment