Skip to content

Commit

Permalink
Lisätty organisaatiorakenteeseen parent_oid=child_oid
Browse files Browse the repository at this point in the history
  • Loading branch information
Matz Rasmus committed Nov 27, 2024
1 parent 7932da7 commit 9585c6a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
18 changes: 14 additions & 4 deletions dbt/models/int/int_yleiskayttoiset/int_organisaatio_rakenne.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,19 @@ org (parent_oid, child_oid) as (
org2.organisaatio_oid as child_oid
from organisaatio as org2
inner join org as orga on orga.child_oid = org2.ylempi_organisaatio
),

final as (
select
parent_oid,
child_oid
from org
union
select
organisaatio_oid as parent_oid,
organisaatio_oid as child_oid
from organisaatio
)

select
parent_oid,
child_oid
from org
select * from final

3 changes: 2 additions & 1 deletion dbt/models/pub/pub_dim_organisaatio_rakenne.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ with source as (
select
parent_oid,
child_oid
from source
from source
order by 1,2

0 comments on commit 9585c6a

Please sign in to comment.