Antal poster i INKOMST: 4260
| Detta villkor är uppfyllt... | ...om denna SQL... | ...returnerar | Kommentar |
|---|---|---|---|
| om antalet individer utan identitet är 0 |
select count(distinct ddbid) from INKOMST where ddbid = 0 |
0 | |
| om alla taxeringsår i SV.INKTAX finns med för alla individer |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
select count(*) from grund a full join inkomst b on a.ddbid = b.ddbid and a.taxar = b.taxar
where b.ddbid is null
|
0 | |
| om alla taxeringsår och individer som finns i SV.INKTAX finns i INKOMST |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a full join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where b.ddbid is null
|
0 | |
| om BSTTXT hämtas från BSTXT i SV.INDIVID |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.BSTTXT != b.BSTTXT and nr=1
|
0 | |
| om TAXINKOMST mellan 1903 och 1910 hämtas från TAXHELHET |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,TAXHELHET,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1903 and 1910 and
a.TAXINKOMST != b.TAXHELHET and nr=1
|
0 | |
| om TAXINKOMST mellan 1911 och 1943 hämtas från STATTAXINKOMST |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,STATTAXINKOMST,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1911 and 1943 and
a.TAXINKOMST != b.STATTAXINKOMST and nr=1
|
0 | |
| om TAXINKOMST mellan 1944 och 1950 hämtas från STATTAXINKOMST |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,BEVTAXINKOMST,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1944 and 1950 and
a.TAXINKOMST != b.BEVTAXINKOMST and nr=1
|
0 | |
| om INKOMST mellan 1863 och 1943 hämtas från BEVSUMMA |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,BEVSUMMA,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1863 and 1943 and
a.INKOMST != b.BEVSUMMA and nr=1
|
0 | |
| om INKOMST mellan 1944 och 1950 hämtas från en summering av följande variabler BEVJORDBRUK, BEVFASTIGHET, BEVBOLAG samt BEVKAPITAL |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,
BEVJORDBRUK,BEVFASTIGHET,BEVBOLAG,BEVKAPITAL,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1944 and 1950 and
a.INKOMST != float(b.BEVJORDBRUK+b.BEVFASTIGHET+b.BEVBOLAG+b.BEVKAPITAL) and nr=1
|
0 | |
| om KAPITAL alltid hämtas från BEVKAPITAL |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,BEVKAPITAL,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where
a.KAPITAL != b.BEVKAPITAL and nr=1
|
0 | |
| om INKFASTEGENDOM mellan 1903 och 1910 hämtas från TAXFASTIGHET |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,TAXFASTIGHET,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1903 and 1910 and
a.INKFASTEGENDOM != b.TAXFASTIGHET and nr=1
|
0 | |
| om INKFASTEGENDOM mellan 1923 och 1928 hämtas från BEVEGENDOM |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,BEVEGENDOM,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1923 and 1928 and
a.INKFASTEGENDOM != b.BEVEGENDOM and nr=1
|
0 | |
| om INKFASTEGENDOM mellan 1929 och 1950 hämtas från en summering av följande variabler BEVJORDBRUK och BEVFASTIGHET |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,BEVJORDBRUK,BEVFASTIGHET,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1929 and 1950 and
a.INKFASTEGENDOM != float(b.BEVJORDBRUK+b.BEVFASTIGHET) and nr=1
|
0 | |
| om INKJORDBRUK hämtas från BEVJORDBRUK |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,BEVJORDBRUK,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.INKJORDBRUK != b.BEVJORDBRUK and nr=1
|
0 | |
| om INKFASTIGHET hämtas från BEVFASTIGHET |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,BEVFASTIGHET,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.INKFASTIGHET != b.BEVFASTIGHET and nr=1
|
0 | |
| om INKNARING hämtas mellan 1863 och 1893 från BEVRORELSE |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,BEVRORELSE,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1863 and 1893 and
a.INKNARING != b.BEVRORELSE and nr=1
|
0 | |
| om INKNARING hämtas mellan 1894 och 1897 från en summering av variablerna BEVRORUNDERHALL och BEVRORANNAN |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,
BEVRORUNDERHALL,BEVRORANNAN,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1894 and 1897 and
a.INKNARING != float(b.BEVRORUNDERHALL+b.BEVRORANNAN) and nr=1
|
0 | |
| om INKNARING hämtas mellan 1898 och 1902 från en summering av variablerna BEVRORVAG och BEVRORANNAN |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,
BEVRORVAG ,BEVRORANNAN,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1898 and 1902 and
a.INKNARING != float(b.BEVRORVAG +b.BEVRORANNAN) and nr=1
|
0 | |
| om INKNARING hämtas mellan 1903 och 1928 från BEVRORELSE |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,
BEVRORELSE,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1903 and 1928 and
a.INKNARING != b.BEVRORELSE and nr=1
|
0 | |
| om INKNARING hämtas mellan 1929 och 1950 från BEVBOLAG |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,
BEVBOLAG,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1903 and 1928 and
a.INKNARING != b.BEVBOLAG and nr=1
|
0 | |
| om INKTJANST hämtas mellan 1864 och 1902 från en summering av variablerna BEVALLMTJANST och BEVENSKTJANST |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,
BEVALLMTJANST ,BEVENSKTJANST,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1898 and 1902 and
a.INKTJANST != float(b.BEVALLMTJANST +b.BEVENSKTJANST) and nr=1
|
0 | |
| om INKTJANST hämtas mellan 1903 och 1928 från BEVTJANST |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,
BEVTJANST,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1903 and 1928 and
a.INKTJANST != b.BEVTJANST and nr=1
|
0 | |
| om INKTJANST hämtas mellan 1929 och 1950 från BEVTILLFTJANST |
with grund as (
select e.taxar, a.individid, a.postnr, a.kon, a.ddbid, a.bsttxt, a.tytxt, b.kbsidid, b.overblivenind, d.sid,
BEVTILLFTJANST,
case when taxar between 1903 and 1910 then coalesce(taxhelhet,0)
when taxar between 1911 and 1943 then coalesce(stattaxinkomst,0)
when taxar between 1944 and 1950 then coalesce(bevtaxinkomst,0)
else 0 end as taxinkomst,
case when taxar between 1863 and 1943 then coalesce(bevsumma,0)
when taxar between 1944 and 1950 then float(coalesce(bevjordbruk,0)+coalesce(bevfastighet,0)+coalesce(bevbolag,0)+coalesce(bevkapital,0))
else 0 end as inkomst
from sv.individ a join sv.notering b on a.postnr = b.postnr
join sv.inktax c on a.postnr = c.postnr
join reg.kbsid d on b.kbsidid = d.kbsidid
join reg.taxar e on d.kbkallaid = e.kbkallaid and d.sid between e.fransidnr and e.tillsidnr
where b.materialtyp = 9 and overblivenind = 0 and eftertaxering = 0)
,sortering as (select rank()over(partition by ddbid,taxar order by taxinkomst desc,inkomst desc) as nr,* from grund)
select count(*) from inkomst a join sortering b on a.ddbid = b.ddbid and a.taxar = b.taxar
where a.taxar between 1929 and 1950 and
a.INKTJANST != b.BEVTILLFTJANST and nr=1
|
0 |