Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added script for #14. This should close the issue. #16

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions sql_scripts/report_cfchlinkedagents.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- Retrieves all agent_persons that are linked to in the CFCH repository. Updating this script to another repository is possible by changing the ao.repo_id code to the desired repository.

SELECT
name_person.sort_name AS agent_name, name_person.agent_person_id AS agent_id, evname.value AS name_source, evrole.value AS role
FROM
linked_agents_rlshp AS rel
JOIN
archival_object AS ao ON ao.id = rel.archival_object_id
LEFT JOIN
resource ON resource.id = rel.resource_id
LEFT JOIN
name_person ON name_person.agent_person_id = rel.agent_person_id
LEFT JOIN
enumeration_value AS evname ON evname.id = name_person.source_id
JOIN
enumeration_value AS evrole ON evrole.id = rel.role_id
JOIN
agent_record_identifier AS recordid ON recordid.id = rel.role_id
WHERE
ao.repo_id = 21
GROUP BY name_person.id

-- To get the above to work properly, you'll need to run this query before running the above: SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode, 'ONLY_FULL_GROUP_BY', ''));