« examples of provenance field in DSPACE | Main | Going from handles to metadata text value in Dspace »

SQL to find DSPACE collection info given item handle

Collection name

Collection name for item handle 94921

SELECT collection.name FROM collection, collection2item, item, handle WHERE collection2item.item_id=item.item_id AND collection2item.collection_id=collection.collection_id AND handle.resource_id=item.item_id AND handle = 94921 ;

Collection handle

Collection handle for item handle 94921

SELECT handle FROM handle WHERE resource_type_id=3 AND resource_id=(SELECT collection.collection_id FROM collection, collection2item, item, handle WHERE collection2item.item_id=item.item_id AND collection2item.collection_id=collection.collection_id AND handle.resource_id=item.item_id AND handle = 94921) ;

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)