Skip to content

Instantly share code, notes, and snippets.

@ruthtillman
Created September 25, 2017 14:52
Show Gist options
  • Save ruthtillman/ad1e87960b3035f1074851f44dd50774 to your computer and use it in GitHub Desktop.
Save ruthtillman/ad1e87960b3035f1074851f44dd50774 to your computer and use it in GitHub Desktop.
Gets records which have person names as 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_person.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_person on linked_agents_rlshp.agent_person_id = name_person.agent_person_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