Skip to content

Instantly share code, notes, and snippets.

@isido
Created April 20, 2016 08:25
Show Gist options
  • Save isido/036373533ab35ef585a3e63bd3ddb790 to your computer and use it in GitHub Desktop.
Save isido/036373533ab35ef585a3e63bd3ddb790 to your computer and use it in GitHub Desktop.
Select items with certain metadata set
select a.text_value "uef.solecris.id", b.text_value "dc.title"
from (
select resource_id, text_value
from metadatavalue
where metadata_field_id = (
select metadata_field_id
from metadatafieldregistry r, metadataschemaregistry s
where s.short_id = 'uef' and r.element = 'solecris'
and r.qualifier = 'id' and r.metadata_schema_id = s.metadata_schema_id)) a
join (
select resource_id, text_value
from metadatavalue
where metadata_field_id = (
select metadata_field_id
from metadatafieldregistry r, metadataschemaregistry s
where s.short_id = 'dc' and r.element = 'title'
and r.qualifier is null and r.metadata_schema_id = s.metadata_schema_id)) b
on a.resource_id = b.resource_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment