> M<=>?@ABCDEFGHIJKL ɀ\p 01>B0 Ba=$#" !$%&'(-B0=830=x<`68X@"16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr1"E Arial Cyr16$ETimes New Roman Cyr1.ETimes New Roman1.ETimes New Roman1.ETimes New Roman16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr1.ETimes New Roman16ETimes New Roman Cyr1.ETimes New Roman16ETimes New Roman Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr1.ETimes New Roman1.ETimes New Roman1EArial1EArial1.ETimes New Roman16ETimes New Roman Cyr16ETimes New Roman Cyr1.ETimes New Roman1.ETimes New Roman16ETimes New Roman Cyr16ETimes New Roman Cyr1"E Arial Cyr1.ETimes New Roman16ETimes New Roman Cyr16ETimes New Roman Cyr1"
E Arial Cyr1"E Arial Cyr1"E Arial Cyr16ETimes New Roman Cyr16ETimes New Roman Cyr1ECalibri1 ECalibri1>ECalibri1?ECalibri14ECalibri1,8ECalibri18ECalibri18ECalibri1ECalibri1 ECalibri1h8ECambria1<ECalibri1ECalibri1ECalibri14ECalibri1
ECalibri1ECalibri/#,##0"@.";\-#,##0"@."9#,##0"@.";[Red]\-#,##0"@.";#,##0.00"@.";\-#,##0.00"@."E #,##0.00"@.";[Red]\-#,##0.00"@."k*3_-* #,##0"@."_-;\-* #,##0"@."_-;_-* "-""@."_-;_-@_-k)3_-* #,##0_@_._-;\-* #,##0_@_._-;_-* "-"_@_._-;_-@_-{,;_-* #,##0.00"@."_-;\-* #,##0.00"@."_-;_-* "-"??"@."_-;_-@_-{+;_-* #,##0.00_@_._-;\-* #,##0.00_@_._-;_-* "-"??_@_._-;_-@_-?#,##0\ "3@=.";\-#,##0\ "3@=."I"#,##0\ "3@=.";[Red]\-#,##0\ "3@=."K##,##0.00\ "3@=.";\-#,##0.00\ "3@=."U(#,##0.00\ "3@=.";[Red]\-#,##0.00\ "3@=."?_-* #,##0\ "3@=."_-;\-* #,##0\ "3@=."_-;_-* "-"\ "3@=."_-;_-@_-E_-* #,##0\ _3_@_=_._-;\-* #,##0\ _3_@_=_._-;_-* "-"\ _3_@_=_._-;_-@_-G_-* #,##0.00\ "3@=."_-;\-* #,##0.00\ "3@=."_-;_-* "-"??\ "3@=."_-;_-@_-M_-* #,##0.00\ _3_@_=_._-;\-* #,##0.00\ _3_@_=_._-;_-* "-"??\ _3_@_=_._-;_-@_-72_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_).)_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)61_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)7#,##0"3@=.";\-#,##0"3@=."A#,##0"3@=.";[Red]\-#,##0"3@=."C#,##0.00"3@=.";\-#,##0.00"3@=."M$#,##0.00"3@=.";[Red]\-#,##0.00"3@=."w9_-* #,##0"3@=."_-;\-* #,##0"3@=."_-;_-* "-""3@=."_-;_-@_-?_-* #,##0_3_@_=_._-;\-* #,##0_3_@_=_._-;_-* "-"_3_@_=_._-;_-@_-A_-* #,##0.00"3@=."_-;\-* #,##0.00"3@=."_-;_-* "-"??"3@=."_-;_-@_-G_-* #,##0.00_3_@_=_._-;\-* #,##0.00_3_@_=_._-;_-* "-"??_3_@_=_._-;_-@_-#"0";"0";"5B"5"AB8=0";"AB8=0";">6L")":;";":;";"K:;"Y*[$ -2]\ ###,000_);[Red]\([$ -2]\ ###,000\) / / / / / / / / / / / / 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 P 5 P 6 6 7 a> 8 ff 9 : ; < % = ` > ? 8 8
"
*8 8 0@ @ "0@ @ 0@ @
0@ @ 8@ @ 8@ @ #0@ @ "0 0 " 0@ 8@ @ @ @ " "8 8@ @ 8@ @ x@ @ x@ @ x @ #p@ @ x@ @ p@ @ "p@ @ x@ @ 8 8 0 8@ @ 8@ @ 8 x x x@ @ 8 " "8 8 8 ( ( 8 "8@ 8@ @ ( 8@@ 8@ @
8@ @
" # 8@ @ 8@ @ 8@ @ x@ @ 8@@ 8@ @ 8@ @ %8@ @ "8@ @ "8@ 8@ @ 8@ @ "8 ( x@@ x@@ 1 1( ( * + + , - 8@ @ #8@ @ 0@ @ x@ @ 0@ @ x@ @ #0@ @ 0@ @ 8@ @ x@ @
8@ @ 8@ @ x@ @
x@ @ x@ @ 8@ @ #8@ @ 0@ @ p@ @ %#8@ @ #8@ @ #8@ @ +8@ @ 8@@ !8 @ !8@@ !8@ !8 @ 8 8 !8@@ !8@ 8@ 8 @ 8@ ( @ 8@@
! (@@ (@
*8
x@ @ ( " 8@ @ 8@@ 8@ 8 @ 8@@ 8@ 8 @ 8 8@@ 8@ 8 @ 8@ 8 @ 8@@ 8@ 8 @ "8@@ "8@ "8 @ x@ @ )x@ @ x@ @ x@@ x @ x@ @ 8@ @ 8@@ 8@ 8 @ 8@ @ )x@@ )x@ )x @ x@ @ x@@ x @ x@ x x@ x 8 x@@ x@ x@@ x@ x @ x@ x x x@ x@ @ x@ @ 8@ @ 8@ 8@ x@ @ "p@ @ (x@ @ 8@ @ 8@ @ 8@@ 8@ 8 @ 8@ @ 8@@ 8@ 8 @ x@ 8@ @ x@ @ x@ @ x @ x@ @ x @ x@ @ (x@ @ 8@ 8 8 8@@ 8@ 8 @ (@ @ 8 x@ @ x@ x@ x@ @ x@ x@ x@ x @ x x x@ x x x@ @ x@ x@ x@ x@ @ x@ 8@ @ 8@ x x x x x @ x@ @ x @ x@ @ x @ x@ @ 8@ @ x @ x@@ 8@ 8 8 x@ 8 8 8@ @ 8@@ 8@ 8@ 8 @ 8@ 8 8 8 8@ 8 8 8@ @ 8@ @ 8@ x@ @ x@ 8@ @ 8@ x@ 8@ 8 @ x@ 8@@ 8@@ 8@ 8 @ !x@@ !x@ !x @ "8@ @ 8@ @ 8 8 x@ @ 8@ @ 8 8@ @ 8@ @ 8@ 8@ x@@ x@ x @ ' & 8@@ 8@ 8@ @ 8@ @ x@ @ x@ 8@@ 8@ 8 @ 8@ 8 8 8@ 8 8 8@@ 8@ 8 @ 8@ 8@ 8 8@@ 8@ 8 @ 8@ 8 8 8@ 8 8 8@ @ x@@ x@ x @ x@ x x 8@@ 8@ 8 @ 8@ @ 8@ @ 8@ @ 8@@ 8 @ 8@ @ 8@ 8@ 8@@ 8@ 8 @ 8@ @ 8@ 8@@ 8@ 8 @ 8@ @ 8@ 8@ 8@@ 8@ 8 @ 8@ @ x@@ x @ 8@ @ 8@ @ 8@ @ 8@ @ 8@ 8@ 8@@ 8@ 8 @ 8@ @ 0@ @ 0@ @ 0@ 8 8@@ 8@ 8 @ 8@ 8 8 8@ 8 8 0@ @ 0@ 0@ 8@ @ 8@ 8@ "8@@ "8@ "8 @ 8 0 !8 .! "8 8 8 "8 "0 8@ "8 8 "8@ @ 8@ @ 8@@ 8@ 8 @ 8@ @ 8@ @ 8@ $8 0@ @ 0@ "0@ @ *0@ @ 8
20% - :F5=B1
20% - :F5=B2
20% - :F5=B3
20% - :F5=B4
20% - :F5=B5
20% - :F5=B6
40% - :F5=B1
40% - :F5=B2
40% - :F5=B3
40% - :F5=B4
40% - :F5=B5
40% - :F5=B6
60% - :F5=B1
60% - :F5=B2
60% - :F5=B3
60% - :F5=B4
60% - :F5=B5!
60% - :F5=B6" Comma [0]#Currency [0]$
Normal_Sheet1%:F5=B1&:F5=B2':F5=B3(:F5=B4):F5=B5*:F5=B6+2>4 ,K2>4-
KG8A;5=85./0103>;>2>: 1203>;>2>: 2303>;>2>: 3403>;>2>: 4
5B>3)6>=B@>;L=0O OG59:070720=85859B@0;L=K99 1KG=K9_1%:1KG=K9_26.02.02';1KG=K9_Tab_Pobyt< =;>E>9> >OA=5=85?
@8<5G0=85@%A!2O70==0O OG59:0-B"5:AB ?@54C?@5645=8O)C"KAOG8 [0]_$C=:F88=D"KAOG8_MS 538AB@0F8O ?@>406EFG%>@>H89`Q=REPNST E0 n2 3 4 J_5 \6 P5 7 8 |
9
+10
Nw11
1228AB1ؠ8AB2k8AB3#1LOGT8AB4qCUsersAlinaAppDataLocalTempRar$DIa0.209DOCUME~1AdminLOCALS~1TempRar$DI01.453PICKFORM451blnk451.xls123456789101112131415161718192021222324Y:lCUsersAlinaAppDataLocalTempRar$DIa0.209DOCUME~1TANYALOCALS~1TEMPFTMP0004.3O0FORM451blnk451.xls @>74.1(0)@>74.1 @>74.2(1) @>74.2(2) @>74.2(3)@>74.3 @>74.4(1) @>74.4(2)@>74.5@>74.6-7@>74.8-9@>74.10@>74.11@>74.12@>74.13
@>74.14-15
@>74.16(1)@>74.16 (2)@>74.17
@>74.18(1)
@>74.18(2)
@>74.19(1)
@>74.19(2)YE@OBROBKAARHPICKRABOTAform066VHODPICKFORM4512008f4510802.xls023456789101112131415161718192021222324YYYYYYYYYY Y
YYY
YYYYYYYYYY-5@OBROBKAARHPICKRABOTAform066FORM451blnk451.xls @>74.1(0)@>74.1 @>74.2(1) @>74.2(2) @>74.2(3)@>74.3 @>74.4(1) @>74.4(2)@>74.5@>74.6-7@>74.8-9@>74.10@>74.11@>74.12@>74.13
@>74.14-15
@>74.16(1)@>74.16 (2)@>74.17
@>74.18(1)
@>74.18(2)
@>74.19(1)
@>74.19(2) @>74.1(1) @>74.1(2)YYa\CUsersAlinaAppDataLocalTempRar$DIa0.209StatistikStatisticEXCELEXAMPLESBOOKST.XLS# EndSeller#FindIt#RegisterReceipt[CUsersAlinaAppDataLocalTempRar$DIa0.209StatistikStatisticEXCELEXAMPLESFUNCS.XLS$C=:F88>4C;8#Search#
SortRUSAsc#SortRUSDesc#
SortUSAAsc#SortUSADescYfCUsersAlinaAppDataLocalTempRar$DIa0.209StatistikStatistic!B0B8AB8:02003=830 (:20@B0;).xls20@B0;Yn
B1< EndSeller9FindIt9# FuncRange; @New9
%RegisterReceipt9Search9# SortRange; @
SortRUSAsc9!SortRUSDesc9
SortUSAAsc9!SortUSADesc91<1<1<1<1<
1<1<02: ;/ ;
/
"CF9
gfvf`@@\
6
3A@@
$0G0;L=8: # 2 %0@:V2AL:V9 >1;0ABV80G0;L=8: 2V44V;C # "102" # 2 %0@:V2AL:V9 >1;0ABV
01.01.2017
31.03.2017,70 3 <VAOFV 2017 @>:C ?> %0@:V2AL:V9 >1;0ABV@>:C@>@ %0@:V2AL:>W >1;0ABVK 45@602=89 @04=8: NAB8FVW 2 :;0AC0=8;LG5=:> ...p] [c.gr1]
[2] [c.gr2]
[3] [c.gr3]
[4] [c.gr4]
[5] [c.gr5]
[6] [c.gr6]
[7] [c.gr7]
[8] [c.gr8]
[9] [c.gr9]
[10] [c.gr10]
[11] [c.gr11]
[12] [c.gr12]
[13] [c.gr13]
[14] [c.gr14]
[15] [c.gr15]
[16] [c.gr16]
[17] [c.gr17]
[18] [c.gr18]
[19] [c.gr19]
[20] [c.gr20]
[21] [c.gr21]
[22] [c.gr22]
[23] [c.gr23]
[24] [c.gr24]
[25] [c.gr25]
[26] [c.gr26]
[27] [c.gr27]
[28] [c.gr28]
[29] [c.gr29]
[30] [c.gr30]
[31] [c.gr31]
[32] [c.gr32]
[33] [c.gr33]
[34] [c.gr34]
[35] [c.gr35]
[36] [c.gr36]
[37] [c.gr37]
[38] [c.gr38]
[39] [c.gr39]
[40] [c.gr40]
[41] [c.gr41]
[42] [c.gr42]
[43] [c.gr43]
[44] [c.gr44]
[45] [c.gr45]
[46] [c.gr46]
[47] [c.gr47]
[48] [c.gr48]
[49] [c.gr49]
[50] [c.gr50]
[51] [c.gr51]
[52] [c.gr52]
[53] [c.gr53]
[54] [c.gr54]
[55] [c.gr55]
[56] [c.gr56]
[57] [c.gr57]
[58] [c.gr58]
[59] [c.gr59]
[60] [c.gr60]
[61] [c.gr61]
[62] [c.gr62]
[63] [c.gr63]
[64] [c.gr64]
[&]
[#! !" ]
[2]
[3] c.dsk in ('1','2')
[4] c.dsk ='3'
[5] c.dsk ='4'
[6] c.dsk in ('5','6','7')
[&]
[&]
[&]
#NEWBLOCK#
[+ ]
[# ! ]
Select pok,
sum(case when gr1>0 then 1 end) gr1,
sum(case when gr2>0 then 1 end) gr2,
sum(case when gr3>0 then 1 end) gr3,
sum(case when gr4>0 then 1 end) gr4,
sum(case when gr5>0 then 1 end) gr5,
sum(case when gr6>0 then 1 end) gr6,
sum(case when gr7>0 then 1 end) gr7,
sum(case when gr8>0 then 1 end) gr8,
sum(case when gr9>0 then 1 end) gr9,
sum(case when gr10>0 then 1 end) gr10,
sum(case when gr11>0 then 1 end) gr11,
sum(case when gr12>0 then 1 end) gr12,
sum(case when gr13>0 then 1 end) gr13,
sum(case when gr14>0 then 1 end) gr14,
sum(case when gr15>0 then 1 end) gr15,
sum(case when gr16>0 then 1 end) gr16,
sum(case when gr17>0 then 1 end) gr17,
sum(case when gr18>0 then 1 end) gr18,
sum(case when gr19>0 then 1 end) gr19,
sum(case when gr20>0 then 1 end) gr20,
sum(case when gr21>0 then 1 end) gr21,
sum(case when gr22>0 then 1 end) gr22,
sum(case when gr23>0 then 1 end) gr23,
sum(case when gr24>0 then 1 end) gr24,
sum(case when gr25>0 then 1 end) gr25,
sum(case when gr26>0 then 1 end) gr26,
sum(case when gr27>0 then 1 end) gr27,
sum(case when gr28>0 then 1 end) gr28,
sum(case when gr29>0 then 1 end) gr29,
sum(case when gr30>0 then 1 end) gr30,
sum(case when gr31>0 then 1 end) gr31,
sum(case when gr32>0 then 1 end) gr32,
sum(case when gr33>0 then 1 end) gr33,
sum(case when gr34>0 then 1 end) gr34,
sum(case when gr35>0 then 1 end) gr35,
sum(case when gr36>0 then 1 end) gr36,
sum(case when gr37>0 then 1 end) gr37,
sum(case when gr38>0 then 1 end) gr38,
sum(case when gr39>0 then 1 end) gr39,
sum(case when gr40>0 then 1 end) gr40,
sum(case when gr41>0 then 1 end) gr41,
sum(case when gr42>0 then 1 end) gr42,
sum(case when gr43>0 then 1 end) gr43,
sum(case when gr44>0 then 1 end) gr44,
sum(case when gr45>0 then 1 end) gr45,
sum(case when gr46>0 then 1 end) gr46,
sum(case when gr47>0 then 1 end) gr47,
sum(case when gr48>< 0 then 1 end) gr48,
sum(case when gr49>0 then 1 end) gr49,
sum(case when gr50>0 then 1 end) gr50,
sum(case when gr51>0 then 1 end) gr51,
sum(case when gr52>0 then 1 end) gr52,
sum(case when gr53>0 then 1 end) gr53,
sum(case when gr54>0 then 1 end) gr54,
sum(case when gr55>0 then 1 end) gr55,
sum(case when gr56>0 then 1 end) gr56,
sum(case when gr57>0 then 1 end) gr57,
sum(case when gr58>0 then 1 end) gr58,
sum(case when gr59>0 then 1 end) gr59,
sum(case when gr60>0 then 1 end) gr60,
sum(case when gr61>0 then 1 end) gr61,
sum(case when gr62>0 then 1 end) gr62,
sum(case when gr63>0 then 1 end) gr63,
sum(case when gr64>0 then 1 end) gr64
from (
SELECT pers,pok,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 is not null then 1 end) gr1,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 between 'N1890002' and 'N1890004' then 1 end) gr2,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 between 'N1910002' and 'N1910005' then 1 end) gr3,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 ='N2060003' then 1 end) gr4,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N232%' then 1 end) gr5,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N2620002','N2620003') then 1 end) gr6,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N353%' then 1 end) gr7,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N3580002','N3580003') then 1 end) gr8,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36400%' then 1 end) gr9,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36401%' then 1 end) gr10,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36500%' then 1 end) gr11,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36501%' then 1 end) gr12,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36502%' then 1 end) gr13,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 ='N3660002' then 1 end) gr14,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36800%' then 1 end) gr15,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36802%' then 1 end) gr16,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36803%' then 1 end) gr17,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36804%' then 1 end) gr18,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36902%' then 1 end) gr19,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 ='N3750002' then 1 end) gr20,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N4100002','N4100003') then 1 end) gr21,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N423%' then 1 end) gr22,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N4240001','N4240003') then 1 end) gr23,
count(case when uoir2 between &pob and &poe and reuk not in ('04','05','06','17') and resuddt is not null then 1 end) gr24,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' then 1 end) gr25,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs in ('01','17') then 1 end) gr26,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs='02' then 1 end) gr27,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs in ('03','04','05','06','07','08','09','10','11') then 1 end) gr28,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs='12' then 1 end) gr29,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs in ('13','16','18') then 1 end)gr30,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs='15' then 1 end) gr31,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='02' and ozasv is null then 1 end) gr32,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='03' and ozasv is null then 1 end) gr33,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='04' and ozasv is null then 1 end) gr34,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='05' and ozasv is null then 1 end) gr35,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='06' and ozasv is null then 1 end) gr36,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='07' and ozasv is null then 1 end) gr37,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='08' and ozasv is null then 1 end) gr38,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='10' and ozasv is null then 1 end) gr39,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and ozasv='01' then 1 end) gr40,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and ozasv='02' then 1 end) gr41,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='1' or dpokv2='1' or dpokv3='1' or dpokv4='1') then 1 end) gr42,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='2' or dpokv2='2' or dpokv3='2' or dpokv4='2') then 1 end) gr43,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='3' or dpokv2='3' or dpokv3='3' or dpokv4='3') then 1 end) gr44,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='4' or dpokv2='4' or dpokv3='4' or dpokv4='4') then 1 end) gr45,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' then 1 end) gr46,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss in ('01','03','17','19') then 1 end) gr47,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss in ('02','04') then 1 end) gr48,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='12' then 1 end) gr49,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='13' then 1 end) gr50,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='14' then 1 end) gr51,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') then 1 end) gr52,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss in ('01','03','17','19') then 1 end) gr53,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss in ('02','04') then 1 end) gr54,
count(case when uoir2 between &pob and &poe and resuddt is no< t null and reuk in ('07','08','10','11','13','14','15','16') and ss ='12' then 1 end) gr55,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss ='13' then 1 end) gr56,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss ='14' then 1 end) gr57,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='07' then 1 end) gr58,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='08' then 1 end) gr59,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='10' then 1 end) gr60,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='11' then 1 end) gr61,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='13' then 1 end) gr62,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='15' then 1 end) gr63,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='14' then 1 end) gr64
FROM IBD.I_KORP11
WHERE UDLN IS NULL
and id like lpad('&id',2,0)||'%'
and pcod='2'
and rzt in ('11','24','30','31','32')
group by pers,pok)
group by pok
[&]
[ 3]
[#! $]
[1] [c.gr1]
[2] [c.gr2]
[3] [c.gr3]
[4] [c.gr4]
[5] [c.gr5]
[6] [c.gr6]
[7] [c.gr7]
[8] [c.gr8]
[9] [c.gr9]
[10] [c.gr10]
[11] [c.gr11]
[12] [c.gr12]
[13] [c.gr13]
[14] [c.gr14]
[15] [c.gr15]
[16] [c.gr16]
[17] [c.gr17]
[18] [c.gr18]
[19] [c.gr19]
[20] [c.gr20]
[21] [c.gr21]
[22] [c.gr22]
[23] [c.gr23]
[24] [c.gr24]
[25] [c.gr25]
[26] [c.gr26]
[27] [c.gr27]
[28] [c.gr28]
[29] [c.gr29]
[30] [c.gr30]
[31] [c.gr31]
[32] [c.gr32]
[33] [c.gr33]
[34] [c.gr34]
[35] [c.gr35]
[36] [c.gr36]
[37] [c.gr37]
[38] [c.gr38]
[39] [c.gr39]
[40] [c.gr40]
[41] [c.gr41]
[42] [c.gr42]
[43] [c.gr43]
[44] [c.gr44]
[45] [c.gr45]
[46] [c.gr46]
[47] [c.gr47]
[48] [c.gr48]
[49] [c.gr49]
[50] [c.gr50]
[51] [c.gr51]
[52] [c.gr52]
[53] [c.gr53]
[54] [c.gr54]
[55] [c.gr55]
[56] [c.gr56]
[57] [c.gr57]
[58] [c.gr58]
[59] [c.gr59]
[60] [c.gr60]
[61] [c.gr61]
[62] [c.gr62]
[63] [c.gr63]
[64] [c.gr64]
[&]
[#! !" ]
[12] c.pok in ('1','2')
[13] c.pok ='3'
[14] c.pok ='4'
[15] c.pok in ('5','6','7')
[&]
[&]
[&]
#NEWBLOCK#
[+ ]
[# ! ]
Select otr,
sum(case when gr1>0 then 1 end) gr1,
sum(case when gr2>0 then 1 end) gr2,
sum(case when gr3>0 then 1 end) gr3,
sum(case when gr4>0 then 1 end) gr4,
sum(case when gr5>0 then 1 end) gr5,
sum(case when gr6>0 then 1 end) gr6,
sum(case when gr7>0 then 1 end) gr7,
sum(case when gr8>0 then 1 end) gr8,
sum(case when gr9>0 then 1 end) gr9,
sum(case when gr10>0 then 1 end) gr10,
sum(case when gr11>0 then 1 end) gr11,
sum(case when gr12>0 then 1 end) gr12,
sum(case when gr13>0 then 1 end) gr13,
sum(case when gr14>0 then 1 end) gr14,
sum(case when gr15>0 then 1 end) gr15,
sum(case when gr16>0 then 1 end) gr16,
sum(case when gr17>0 then 1 end) gr17,
sum(case when gr18>0 then 1 end) gr18,
sum(case when gr19>0 then 1 end) gr19,
sum(case when gr20>0 then 1 end) gr20,
sum(case when gr21>0 then 1 end) < gr21,
sum(case when gr22>0 then 1 end) gr22,
sum(case when gr23>0 then 1 end) gr23,
sum(case when gr24>0 then 1 end) gr24,
sum(case when gr25>0 then 1 end) gr25,
sum(case when gr26>0 then 1 end) gr26,
sum(case when gr27>0 then 1 end) gr27,
sum(case when gr28>0 then 1 end) gr28,
sum(case when gr29>0 then 1 end) gr29,
sum(case when gr30>0 then 1 end) gr30,
sum(case when gr31>0 then 1 end) gr31,
sum(case when gr32>0 then 1 end) gr32,
sum(case when gr33>0 then 1 end) gr33,
sum(case when gr34>0 then 1 end) gr34,
sum(case when gr35>0 then 1 end) gr35,
sum(case when gr36>0 then 1 end) gr36,
sum(case when gr37>0 then 1 end) gr37,
sum(case when gr38>0 then 1 end) gr38,
sum(case when gr39>0 then 1 end) gr39,
sum(case when gr40>0 then 1 end) gr40,
sum(case when gr41>0 then 1 end) gr41,
sum(case when gr42>0 then 1 end) gr42,
sum(case when gr43>0 then 1 end) gr43,
sum(case when gr44>0 then 1 end) gr44,
sum(case when gr45>0 then 1 end) gr45,
sum(case when gr46>0 then 1 end) gr46,
sum(case when gr47>0 then 1 end) gr47,
sum(case when gr48>0 then 1 end) gr48,
sum(case when gr49>0 then 1 end) gr49,
sum(case when gr50>0 then 1 end) gr50,
sum(case when gr51>0 then 1 end) gr51,
sum(case when gr52>0 then 1 end) gr52,
sum(case when gr53>0 then 1 end) gr53,
sum(case when gr54>0 then 1 end) gr54,
sum(case when gr55>0 then 1 end) gr55,
sum(case when gr56>0 then 1 end) gr56,
sum(case when gr57>0 then 1 end) gr57,
sum(case when gr58>0 then 1 end) gr58,
sum(case when gr59>0 then 1 end) gr59,
sum(case when gr60>0 then 1 end) gr60,
sum(case when gr61>0 then 1 end) gr61,
sum(case when gr62>0 then 1 end) gr62,
sum(case when gr63>0 then 1 end) gr63,
sum(case when gr64>0 then 1 end) gr64
from (
SELECT pers,otr,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 is not null then 1 end) gr1,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 between 'N1890002' and 'N1890004' then 1 end) gr2,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 between 'N1910002' and 'N1910005' then 1 end) gr3,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 ='N2060003' then 1 end) gr4,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N232%' then 1 end) gr5,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N2620002','N2620003') then 1 end) gr6,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N353%' then 1 end) gr7,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N3580002','N3580003') then 1 end) gr8,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36400%' then 1 end) gr9,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36401%' then 1 end) gr10,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36500%' then 1 end) gr11,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36501%' then 1 end) gr12,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36502%' then 1 end) gr13,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 ='N3660002' then 1 end) gr14,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36800%' then 1 end) gr15,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36802%' then 1 end) gr16,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36803%' then 1 end) gr17,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36804%' then 1 end) gr18,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36902%' then 1 end) gr19,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 ='N3750002' then 1 end) gr20,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N4100002','N4100003') then 1 end) gr21,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N423%' then 1 end) gr22,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N4240001','N4240003') then 1 end) gr23,
count(case when uoir2 between &pob and &poe and reuk not in ('04','05','06','17') and resuddt is not null then 1 end) gr24,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' then 1 end) gr25,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs in ('01','17') then 1 end) gr26,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs='02' then 1 end) gr27,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs in ('03','04','05','06','07','08','09','10','11') then 1 end) gr28,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs='12' then 1 end) gr29,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs in ('13','16','18') then 1 end)gr30,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs='15' then 1 end) gr31,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='02' and ozasv is null then 1 end) gr32,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='03' and ozasv is null then 1 end) gr33,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='04' and ozasv is null then 1 end) gr34,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='05' and ozasv is null then 1 end) gr35,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='06' and ozasv is null then 1 end) gr36,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='07' and ozasv is null then 1 end) gr37,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='08' and ozasv is null then 1 end) gr38,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='10' and ozasv is null then 1 end) gr39,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and ozasv='01' then 1 end) gr40,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and ozasv='02' then 1 end) gr41,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='1' or dpokv2='1' or dpokv3='1' or dpokv4='1') then 1 end) gr42,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='2' or dpokv2='2' or dpokv3='2' or dpokv4='2') then 1 end) gr43,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='3' or dpokv2='3' or dpokv3='3' or dpokv4='3') then 1 end) gr44,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='4' or dpokv2='4' or dpokv3='4' or dpokv4='4') then 1 end) gr45,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' then 1 end) gr46,
count(case when uoir2 between &pob an< d &poe and resuddt is not null and reuk ='02' and ss in ('01','03','17','19') then 1 end) gr47,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss in ('02','04') then 1 end) gr48,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='12' then 1 end) gr49,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='13' then 1 end) gr50,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='14' then 1 end) gr51,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') then 1 end) gr52,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss in ('01','03','17','19') then 1 end) gr53,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss in ('02','04') then 1 end) gr54,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss ='12' then 1 end) gr55,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss ='13' then 1 end) gr56,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss ='14' then 1 end) gr57,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='07' then 1 end) gr58,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='08' then 1 end) gr59,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='10' then 1 end) gr60,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='11' then 1 end) gr61,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='13' then 1 end) gr62,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='15' then 1 end) gr63,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='14' then 1 end) gr64
FROM IBD.I_KORP11
WHERE UDLN IS NULL
and id like lpad('&id',2,0)||'%'
and pcod='2'
group by pers,otr)
group by otr
[&]
[ 3]
[#! $]
[1] [c.gr1]
[2] [c.gr2]
[3] [c.gr3]
[4] [c.gr4]
[5] [c.gr5]
[6] [c.gr6]
[7] [c.gr7]
[8] [c.gr8]
[9] [c.gr9]
[10] [c.gr10]
[11] [c.gr11]
[12] [c.gr12]
[13] [c.gr13]
[14] [c.gr14]
[15] [c.gr15]
[16] [c.gr16]
[17] [c.gr17]
[18] [c.gr18]
[19] [c.gr19]
[20] [c.gr20]
[21] [c.gr21]
[22] [c.gr22]
[23] [c.gr23]
[24] [c.gr24]
[25] [c.gr25]
[26] [c.gr26]
[27] [c.gr27]
[28] [c.gr28]
[29] [c.gr29]
[30] [c.gr30]
[31] [c.gr31]
[32] [c.gr32]
[33] [c.gr33]
[34] [c.gr34]
[35] [c.gr35]
[36] [c.gr36]
[37] [c.gr37]
[38] [c.gr38]
[39] [c.gr39]
[40] [c.gr40]
[41] [c.gr41]
[42] [c.gr42]
[43] [c.gr43]
[44] [c.gr44]
[45] [c.gr45]
[46] [c.gr46]
[47] [c.gr47]
[48] [c.gr48]
[49] [c.gr49]
[50] [c.gr50]
[51] [c.gr51]
[52] [c.gr52]
[53] [c.gr53]
[54] [c.gr54]
[55] [c.gr55]
[56] [c.gr56]
[57] [c.gr57]
[58] [c.gr58]
[59] [c.gr59]
[60] [c.gr60]
[61] [c.gr61]
[62] [c.gr62]
[63] [c.gr63]
[64] [c.gr64]
[&]
[#!< !" ]
[37] c.otr = '09'
[38] c.otr = '10'
[39] c.otr = '04'
[40] c.otr = '03'
[41] c.otr = '01'
[42] c.otr = '02'
[43] c.otr = '05'
[44] c.otr = '15'
[45] c.otr = '11'
[46] c.otr = '12'
[47] c.otr = '13'
[48] c.otr = '14'
[&]
[&]
[&]
0u2' and ss in ('02','04') then 1 end) gr48,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='12' then 1 end) gr49,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='13' then 1 end) gr50,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='14' then 1 end) gr51,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') then 1 end) gr52,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss in ('01','03','17','19') then 1 end) gr53,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss in ('02','04') then 1 end) gr54,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss ='12' then 1 end) gr55,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss ='13' then 1 end) gr56,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss ='14' then 1 end) gr57,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='07' then 1 end) gr58,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='08' then 1 end) gr59,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='10' then 1 end) gr60,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='11' then 1 end) gr61,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='13' then 1 end) gr62,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='15' then 1 end) gr63,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='14' then 1 end) gr64
FROM IBD.I_KORP11
WHERE UDLN IS NULL
and id like lpad('&id',2,0)||'%'
and pcod='2'
group by pers)
[&]
[ 3]
[#! $]
[1] [c.gr1]
[2] [c.gr2]
[3] [c.gr3]
[4] [c.gr4]
[5] [c.gr5]
[6] [c.gr6]
[7] [c.gr7]
[8] [c.gr8]
[9] [c.gr9]
[10] [c.gr10]
[11] [c.gr11]
[12] [c.gr12]
[13] [c.gr13]
[14] [c.gr14]
[15] [c.gr15]
[16] [c.gr16]
[17] [c.gr17]
[18] [c.gr18]
[19] [c.gr19]
[20] [c.gr20]
[21] [c.gr21]
[22] [c.gr22]
[23] [c.gr23]
[24] [c.gr24]
[25] [c.gr25]
[26] [c.gr26]
[27] [c.gr27]
[28] [c.gr28]
[29] [c.gr29]
[30] [c.gr30]
[31] [c.gr31]
[32] [c.gr32]
[33] [c.gr33]
[34] [c.gr34]
[35] [c.gr35]
[36] [c.gr36]
[37] [c.gr37]
[38] [c.gr38]
[39] [c.gr39]
[40] [c.gr40]
[41] [c.gr41]
[42] [c.gr42]
[43] [c.gr43]
[44] [c.gr44]
[45] [c.gr45]
[46] [c.gr46]
[47] [c.gr47]
[48] [c.gr48]
[49] [c.gr49]
[50] [c.gr50]
[51] [c.gr51]
[52] [c.gr52]
[53] [c.gr53]
[54] [c.gr54]
[55] [c.gr55]
[56] [c.gr56]
[57] [c.gr57]
[58] [c.gr58]
[59] [c.gr59]
[60] [c.gr60]
[61] [c.gr61]
< [62] [c.gr62]
[63] [c.gr63]
[64] [c.gr64]
[&]
[#! !" ]
[1]
[&]
[&]
[&]
#NEWBLOCK#
[+ ]
[# ! ]
Select rzt,
sum(case when gr1>0 then 1 end) gr1,
sum(case when gr2>0 then 1 end) gr2,
sum(case when gr3>0 then 1 end) gr3,
sum(case when gr4>0 then 1 end) gr4,
sum(case when gr5>0 then 1 end) gr5,
sum(case when gr6>0 then 1 end) gr6,
sum(case when gr7>0 then 1 end) gr7,
sum(case when gr8>0 then 1 end) gr8,
sum(case when gr9>0 then 1 end) gr9,
sum(case when gr10>0 then 1 end) gr10,
sum(case when gr11>0 then 1 end) gr11,
sum(case when gr12>0 then 1 end) gr12,
sum(case when gr13>0 then 1 end) gr13,
sum(case when gr14>0 then 1 end) gr14,
sum(case when gr15>0 then 1 end) gr15,
sum(case when gr16>0 then 1 end) gr16,
sum(case when gr17>0 then 1 end) gr17,
sum(case when gr18>0 then 1 end) gr18,
sum(case when gr19>0 then 1 end) gr19,
sum(case when gr20>0 then 1 end) gr20,
sum(case when gr21>0 then 1 end) gr21,
sum(case when gr22>0 then 1 end) gr22,
sum(case when gr23>0 then 1 end) gr23,
sum(case when gr24>0 then 1 end) gr24,
sum(case when gr25>0 then 1 end) gr25,
sum(case when gr26>0 then 1 end) gr26,
sum(case when gr27>0 then 1 end) gr27,
sum(case when gr28>0 then 1 end) gr28,
sum(case when gr29>0 then 1 end) gr29,
sum(case when gr30>0 then 1 end) gr30,
sum(case when gr31>0 then 1 end) gr31,
sum(case when gr32>0 then 1 end) gr32,
sum(case when gr33>0 then 1 end) gr33,
sum(case when gr34>0 then 1 end) gr34,
sum(case when gr35>0 then 1 end) gr35,
sum(case when gr36>0 then 1 end) gr36,
sum(case when gr37>0 then 1 end) gr37,
sum(case when gr38>0 then 1 end) gr38,
sum(case when gr39>0 then 1 end) gr39,
sum(case when gr40>0 then 1 end) gr40,
sum(case when gr41>0 then 1 end) gr41,
sum(case when gr42>0 then 1 end) gr42,
sum(case when gr43>0 then 1 end) gr43,
sum(case when gr44>0 then 1 end) gr44,
sum(case when gr45>0 then 1 end) gr45,
sum(case when gr46>0 then 1 end) gr46,
sum(case when gr47>0 then 1 end) gr47,
sum(case when gr48>0 then 1 end) gr48,
sum(case when gr49>0 then 1 end) gr49,
sum(case when gr50>0 then 1 end) gr50,
sum(case when gr51>0 then 1 end) gr51,
sum(case when gr52>0 then 1 end) gr52,
sum(case when gr53>0 then 1 end) gr53,
sum(case when gr54>0 then 1 end) gr54,
sum(case when gr55>0 then 1 end) gr55,
sum(case when gr56>0 then 1 end) gr56,
sum(case when gr57>0 then 1 end) gr57,
sum(case when gr58>0 then 1 end) gr58,
sum(case when gr59>0 then 1 end) gr59,
sum(case when gr60>0 then 1 end) gr60,
sum(case when gr61>0 then 1 end) gr61,
sum(case when gr62>0 then 1 end) gr62,
sum(case when gr63>0 then 1 end) gr63,
sum(case when gr64>0 then 1 end) gr64
from (
SELECT pers,rzt,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 is not null then 1 end) gr1,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 between 'N1890002' and 'N1890004' then 1 end) gr2,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 between 'N1910002' and 'N1910005' then 1 end) gr3,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 ='N2060003' then 1 end) gr4,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N232%' then 1 end) gr5,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N2620002','N2620003') then 1 end) gr6,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N353%' then 1 end) gr7,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N3580002','N358< 0003') then 1 end) gr8,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36400%' then 1 end) gr9,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36401%' then 1 end) gr10,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36500%' then 1 end) gr11,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36501%' then 1 end) gr12,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36502%' then 1 end) gr13,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 ='N3660002' then 1 end) gr14,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36800%' then 1 end) gr15,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36802%' then 1 end) gr16,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36803%' then 1 end) gr17,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36804%' then 1 end) gr18,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N36902%' then 1 end) gr19,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 ='N3750002' then 1 end) gr20,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N4100002','N4100003') then 1 end) gr21,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 like 'N423%' then 1 end) gr22,
count(case when uoir1 between &pob and &poe and rekpk is not null and stuk1 in ('N4240001','N4240003') then 1 end) gr23,
count(case when uoir2 between &pob and &poe and reuk not in ('04','05','06','17') and resuddt is not null then 1 end) gr24,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' then 1 end) gr25,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs in ('01','17') then 1 end) gr26,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs='02' then 1 end) gr27,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs in ('03','04','05','06','07','08','09','10','11') then 1 end) gr28,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs='12' then 1 end) gr29,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs in ('13','16','18') then 1 end)gr30,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and vs='15' then 1 end) gr31,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='02' and ozasv is null then 1 end) gr32,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='03' and ozasv is null then 1 end) gr33,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='04' and ozasv is null then 1 end) gr34,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='05' and ozasv is null then 1 end) gr35,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='06' and ozasv is null then 1 end) gr36,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='07' and ozasv is null then 1 end) gr37,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='08' and ozasv is null then 1 end) gr38,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and opokv='10' and ozasv is null then < 1 end) gr39,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and ozasv='01' then 1 end) gr40,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and ozasv='02' then 1 end) gr41,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='1' or dpokv2='1' or dpokv3='1' or dpokv4='1') then 1 end) gr42,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='2' or dpokv2='2' or dpokv3='2' or dpokv4='2') then 1 end) gr43,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='3' or dpokv2='3' or dpokv3='3' or dpokv4='3') then 1 end) gr44,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='01' and (dpokv1='4' or dpokv2='4' or dpokv3='4' or dpokv4='4') then 1 end) gr45,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' then 1 end) gr46,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss in ('01','03','17','19') then 1 end) gr47,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss in ('02','04') then 1 end) gr48,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='12' then 1 end) gr49,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='13' then 1 end) gr50,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='02' and ss ='14' then 1 end) gr51,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') then 1 end) gr52,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss in ('01','03','17','19') then 1 end) gr53,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss in ('02','04') then 1 end) gr54,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss ='12' then 1 end) gr55,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss ='13' then 1 end) gr56,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk in ('07','08','10','11','13','14','15','16') and ss ='14' then 1 end) gr57,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='07' then 1 end) gr58,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='08' then 1 end) gr59,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='10' then 1 end) gr60,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='11' then 1 end) gr61,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='13' then 1 end) gr62,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='15' then 1 end) gr63,
count(case when uoir2 between &pob and &poe and resuddt is not null and reuk ='14' then 1 end) gr64
FROM IBD.I_KORP11
WHERE UDLN IS NULL
and id like lpad('&id',2,0)||'%'
and pcod='2'