Skip to content

Instantly share code, notes, and snippets.

@ruthtillman
Created September 25, 2017 14:55
Show Gist options
  • Save ruthtillman/769da16a4336abc5408ea608fe9d6926 to your computer and use it in GitHub Desktop.
Save ruthtillman/769da16a4336abc5408ea608fe9d6926 to your computer and use it in GitHub Desktop.
Gets records which have corporate entity names agents and returns those. It looks like sometimes it may return the record twice, perhaps if two agents?
SELECT
accession.identifier,
accession.title,
accession.create_time,
accession.accession_date,
accession.general_note,
date.expression,
date.begin,
date.end,
accession.content_description,
accession.provenance,
extent.number,
enumeration_value.value,
extent.container_summary,
user_defined.real_1,
name_corporate_entity.primary_name
FROM
accession
JOIN
extent ON accession.id = extent.accession_id
JOIN
enumeration_value ON extent.extent_type_id = enumeration_value.id
JOIN
date ON accession.id = date.accession_id
JOIN
user_defined ON accession.id = user_defined.accession_id
JOIN
linked_agents_rlshp ON accession.id = linked_agents_rlshp.accession_id
JOIN name_corporate_entity on linked_agents_rlshp.agent_corporate_entity_id = name_corporate_entity.agent_corporate_entity_id
WHERE
accession_date > '2016-06-30'
AND accession_date < '2017-07-01'
AND repo_id = 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment