| Detta villkor är uppfyllt... | ...om denna SQL... | ...returnerar | ... och eventuell kommentar. |
|---|---|---|---|
| Varje person som har CIVILNR = 15 ska också ha en post där CIVILNR = 14. Varje person som har CIVILNR = 14 ska också ha en post där CIVILNR = 13. osv. |
select count(*)
from K136.CIVILSTAND
where (civilnr = 15 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 14) ) or
(civilnr = 14 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 13) ) or
(civilnr = 13 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 12) ) or
(civilnr = 12 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 11) ) or
(civilnr = 11 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 10) ) or
(civilnr = 10 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 9) ) or
(civilnr = 9 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 8) ) or
(civilnr = 8 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 7) ) or
(civilnr = 7 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 6) ) or
(civilnr = 6 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 5) ) or
(civilnr = 5 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 4) ) or
(civilnr = 4 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 3) ) or
(civilnr = 3 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 2) ) or
(civilnr = 2 and
ddbid not in (select ddbid from k136.CIVILSTAND
where civilnr = 1) )
|
0 |