Commit 5fdafaf6 authored by guglielmo's avatar guglielmo

views_definitions added to docs

parent acf43cec
*.sql
/*.sql
.DS_Store
# these queries are defined in views, so data extraction from them is straightforward
# atto_texts view
# acts and their texts
# more than one document may be available for an act
SELECT
a.id as atto_id,
ta.descrizione as tipo_atto,
a.titolo,
d.testo
FROM
opp_atto a
JOIN opp_documento d on a.id=d.atto_id
JOIN opp_tipo_atto ta on a.tipo_atto_id=ta.id;
# atto_tags view
# how an act has been tagged manually
# more than a tag per act, and each tag may have more than one super-tag
SELECT
tagging.taggable_id as atto_id,
tag.triple_namespace as tag_type,
tag.triple_value tag_value,
tt.denominazione as super_tag
FROM
sf_tagging as tagging
JOIN sf_tag as tag ON tag.id=tagging.tag_id
LEFT JOIN opp_tag_has_tt thtt ON thtt.tag_id=tag.id
JOIN opp_teseott as tt ON thtt.teseott_id=tt.id
WHERE tagging.taggable_model='OppAtto';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment