Browse Source

Views werden in module.xml defininiert

xcube0.1
Marlies Winterstein 1 year ago
parent
commit
f8f5227eac
  1. 53
      src-modules/module/xcube/schluesseltabellen/create_views.sql

53
src-modules/module/xcube/schluesseltabellen/create_views.sql

@ -1,53 +0,0 @@ @@ -1,53 +0,0 @@
drop view if exists xcube_wohnort_staat;
create view xcube_wohnort_staat(
druck,
apnr,
parent) as
select 'alle'::varchar(255) as druck ,
'alle'::char(10) as apnr,
null as parent
from xdummy
union
select 'Deutschland'::varchar(255) as druck ,
'0'::char(10) as apnr,
'alle' as parent
from xdummy
union select druck,
apnr,
'0' as parent
from cifx where key=8
union select druck,
'' || val(astat) as apnr ,
bund_apnr as parent
from cifx where key=11
union select 'Ausland' druck , '1' apnr, 'alle' as parent from xdummy
union select druck,apnr,'1' from cifx where key=747 and parent is not null
union select druck, case when astat='' or astat is null then apnr else astat end ,
case when bund_apnr='' or bund_apnr='---' or bund_apnr is null then '-9999' else bund_apnr end from cifx where key=12 and apnr != 'D'
union
select 'unbekannt' druck, '-9999' apnr, 'alle' as parent from xdummy;
drop view if exists xcube_hoererstatus;
create view xcube_hoererstatus (druck, apnr, parent) as
select 'Alle'::varchar(255) as druck,'A' as apnr,null::char(10) as parent
from xdummy
union
select 'Haupt-/Nebenhörer'::varchar(255) as druck,'A1' as apnr,'A'::char(10) as parent
from xdummy
union select druck::varchar(255), apnr, 'A1'::char(10) as parent from cifx where key= 613 and astat='1'
union
select 'Zweithörer'::varchar(255) as druck,'A2' as apnr,'A'::char(10) as parent
from xdummy
union select druck::varchar(255), apnr, 'A2'::char(10) as parent from cifx where key= 613 and astat='2'
union
select 'Deutschkurs/Studienkolleg'::varchar(255) as druck,'A3' as apnr,'A'::char(10) as parent
from xdummy
union select druck::varchar(255), apnr, 'A3'::char(10) as parent from cifx where key= 613 and astat='3'
union
select 'Gasthörer'::varchar(255) as druck,'A4' as apnr,'A'::char(10) as parent
from xdummy
union select druck::varchar(255), apnr, 'A4'::char(10) as parent from cifx where key= 613 and astat='4'
union
select 'Sonstige'::varchar(255) as druck,'A99' as apnr,'A'::char(10) as parent
from xdummy
union select druck::varchar(255), apnr, 'A99'::char(10) as parent from cifx where key= 613 and astat not in ('1','2','3','4')
Loading…
Cancel
Save