Skip to content

Commit

Permalink
fix errors in view query
Browse files Browse the repository at this point in the history
  • Loading branch information
smnorris committed Mar 5, 2024
1 parent 70e8769 commit c6710e9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions db/views/01_streams.sql
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ mcbi_a as (
case
when a.remediated_dnstr_ind is true then 'REMEDIATED' -- remediated crossing is downstream (with no additional barriers in between)
when a.barriers_dams_dnstr is not null then 'DAM' -- a dam barrier is present downstream
when a.barriers_pscis_dnstr is not null then then 'ASSESSED' -- a pscis barrier is present downstream
when a.barriers_pscis_dnstr is not null then 'ASSESSED' -- a pscis barrier is present downstream
when a.barriers_anthropogenic_dnstr is not null then 'MODELLED' -- a modelled barrier is downstream
when a.barriers_anthropogenic_dnstr is null then 'NONE' -- no barriers exist downstream
end as mapping_code_barrier,
Expand Down Expand Up @@ -490,16 +490,15 @@ select
else null end
], ';') as mapping_code_salmon
from bcfishpass.streams s
inner join mcbi_r mr on s.segmented_stream_id = m.segmented_stream_id
inner join mcbi_a ma on s.segmented_stream_id = m.segmented_stream_id
inner join mcbi_r mr on s.segmented_stream_id = mr.segmented_stream_id
inner join mcbi_a ma on s.segmented_stream_id = ma.segmented_stream_id
inner join bcfishpass.streams_access_vw a on s.segmented_stream_id = a.segmented_stream_id
inner join bcfishpass.streams_habitat_linear_vw h on s.segmented_stream_id = h.segmented_stream_id;

create unique index on bcfishpass.streams_mapping_code_vw (segmented_stream_id);


-- final output spatial streams view
drop view if exists bcfishpass.streams_vw;
create view bcfishpass.streams_vw as
select
s.segmented_stream_id,
Expand Down

0 comments on commit c6710e9

Please sign in to comment.