Advertisement
bytecoded

Top 5 Query

Nov 4th, 2019
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.05 KB | None | 0 0
  1. 27.895=TotalDurationSec,1.468=AvgDurationSec,19=Execs,,4,Sql="INSERT INTO #tt WITH(TABLOCK) (_Q_001_F_000RRef, _Q_001_F_001, _Q_001_F_002RRef, _Q_001_F_003, _Q_001_F_004RRef) SELECT
  2. T1._Q_001_F_001RRef,
  3. T1._Q_001_F_002,
  4. T1._Q_001_F_003RRef,
  5. CASE WHEN (1=1) AND CASE WHEN 1=1 THEN CASE WHEN 1=1 THEN 0 ELSE 2000000000 END + 2000000000 ELSE 0 END = 2000000000 THEN CAST(SUM(ISNULL(CAST(CASE WHEN (T1._Q_001_F_000RRef = 0x00000000000000000000000000000000) THEN CAST(((CAST((CAST(T2._Q_001_F_000 AS NUMERIC(26, 2)) * CAST(T4._Q_000_F_001 AS NUMERIC(11, 6))) AS NUMERIC(29, 8)) * CAST(T1._Q_001_F_005 AS NUMERIC(8, 0))) / (T1._Q_001_F_004 * ISNULL(CAST(T4._Q_000_F_002 AS NUMERIC(10, 0)),1.0))) AS NUMERIC(15, 2)) ELSE T2._Q_001_F_000 END AS NUMERIC(33, 2)),0.0)) AS NUMERIC(38, 8)) END,
  6. T1._Q_001_F_000RRef
  7. FROM #tt T1 WITH(NOLOCK)
  8. LEFT OUTER JOIN #tt T2 WITH(NOLOCK)
  9. LEFT OUTER JOIN dbo._Reference43 T3
  10. ON (T2._Q_001_F_001RRef = T3._IDRRef) AND (T3._Fld595 = ?)
  11. LEFT OUTER JOIN #tt T4 WITH(NOLOCK)
  12. ON (T3._Fld1083RRef = T4._Q_000_F_000RRef)
  13. ON CASE WHEN (T1._Q_001_F_000RRef = ?) THEN 0x01 ELSE CASE WHEN (T1._Q_001_F_000RRef = T2._Q_001_F_001RRef) THEN 0x01 WHEN NOT (T1._Q_001_F_000RRef = T2._Q_001_F_001RRef) THEN 0x00 END END = 0x01
  14. WHERE (T1._Q_001_F_001RRef = ?)
  15. GROUP BY T1._Q_001_F_001RRef,
  16. T1._Q_001_F_002,
  17. T1._Q_001_F_000RRef,
  18. T1._Q_001_F_003RRef
  19. UNION ALL SELECT
  20. T5._Q_001_F_001RRef,
  21. T5._Q_001_F_002,
  22. T5._Q_001_F_003RRef,
  23. CAST(SUM(ISNULL(CAST(CASE WHEN (T5._Q_001_F_000RRef = 0x00000000000000000000000000000000) THEN CAST(((CAST((CAST(T6.Fld11503Balance_ AS NUMERIC(26, 2)) * CAST(T29._Q_000_F_001 AS NUMERIC(11, 6))) AS NUMERIC(29, 8)) * CAST(T5._Q_001_F_005 AS NUMERIC(8, 0))) / (T5._Q_001_F_004 * ISNULL(CAST(T29._Q_000_F_002 AS NUMERIC(10, 0)),1.0))) AS NUMERIC(15, 2)) ELSE T6.Fld11503Balance_ END AS NUMERIC(33, 2)),0.0)) AS NUMERIC(38, 8)),
  24. T5._Q_001_F_000RRef
  25. FROM #tt T5 WITH(NOLOCK)
  26. LEFT OUTER JOIN (SELECT
  27. MIN(ISNULL(T7.SDBL_RLS_SIGNAL_,0x01)) AS SDBL_RLS_SIGNAL_,
  28. T7.Fld11497RRef AS Fld11497RRef,
  29. CAST(SUM(T7.Fld11503Balance_) AS NUMERIC(38, 8)) AS Fld11503Balance_
  30. FROM (SELECT
  31. MIN(T8.SDBL_RLS_SIGNAL_) AS SDBL_RLS_SIGNAL_,
  32. T8.Fld11497RRef AS Fld11497RRef,
  33. CAST(SUM(T8.Fld11503_) AS NUMERIC(33, 8)) AS Fld11503Balance_
  34. FROM (SELECT
  35. CASE WHEN (EXISTS(SELECT
  36. 1
  37. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  38. LEFT OUTER JOIN dbo._Reference42 T10
  39. ON ((T9._Fld11496RRef = T10._IDRRef)) AND (T10._Fld595 = ?)
  40. WHERE EXISTS(SELECT
  41. 0x01 AS Q_001_F_000_
  42. FROM dbo._Reference98 T11
  43. INNER JOIN dbo._Reference21 T12
  44. ON (((T11._Fld1685 = ?) AND EXISTS(SELECT
  45. 0x01 AS Q_004_F_000_
  46. FROM dbo._InfoRg11709 T13
  47. WHERE ((T13._Fld595 = ?)) AND ((T13._Fld12065RRef = T11._IDRRef) AND (T13._Fld12066RRef = T12._IDRRef)))) AND T12._IDRRef IN
  48. (SELECT
  49. T14._Reference21_IDRRef AS Q_005_F_000RRef
  50. FROM dbo._Reference21_VT782 T14
  51. INNER JOIN dbo._InfoRg9937 T15
  52. ON ((T15._Fld9939_TYPE = 0x08 AND T15._Fld9939_RTRef = 0x00000095 AND T15._Fld9939_RRRef = ?) AND (T15._Fld9938_TYPE = T14._Fld784_TYPE AND T15._Fld9938_RTRef = T14._Fld784_RTRef AND T15._Fld9938_RRRef = T14._Fld784_RRRef))
  53. WHERE ((T14._Fld595 = ?)) AND (T15._Fld595 = ?)))
  54. WHERE ((T12._Fld595 = ?)) AND ((CASE WHEN T10._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T10._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  55. 0x01 AS Q_002_F_000_
  56. FROM dbo._InfoRg11710 T16
  57. WHERE ((T16._Fld595 = ?)) AND ((T16._Fld12072RRef = T12._IDRRef) AND (T16._Fld12073_TYPE = CASE WHEN T10._Fld12836RRef IS NOT NULL THEN 0x08 END AND T16._Fld12073_RTRef = CASE WHEN T10._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T16._Fld12073_RRRef = T10._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  58. 0x01 AS Q_003_F_000_
  59. FROM dbo._InfoRg11715 T17
  60. WHERE ((T17._Fld595 = ?)) AND ((T17._Fld12199RRef = T12._IDRRef) AND T17._Fld12200_TYPE = CASE WHEN T10._Fld12836RRef IS NOT NULL THEN 0x08 END AND T17._Fld12200_RTRef = CASE WHEN T10._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T17._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))))) THEN 0x01 ELSE 0x00 END AS SDBL_RLS_SIGNAL_,
  61. T9._Fld11496RRef AS Fld11496RRef,
  62. T9._Fld595 AS Fld595_,
  63. T9._Period AS Period_,
  64. T9._Fld11503 AS Fld11503_,
  65. T9._Fld11497RRef AS Fld11497RRef,
  66. T9._Fld11494RRef AS Fld11494RRef
  67. FROM dbo._AccumRgT11507 T9
  68. WHERE (T9._Period = ? AND T9._Fld11494RRef = ? AND T9._Fld11496RRef = ? AND T9._Fld11503 <> ? AND T9._Fld11503 <> ?) AND (T9._Fld595 = ?)) T8
  69. WHERE T8.Period_ = ? AND (((T8.Fld11494RRef = ?) AND (T8.Fld11496RRef = ?))) AND (T8.Fld11503_ <> ?) AND (T8.Fld11503_ <> ?)
  70. GROUP BY T8.Fld11497RRef
  71. HAVING (CAST(SUM(T8.Fld11503_) AS NUMERIC(33, 8))) <> 0.0
  72. UNION ALL SELECT
  73. MIN(T18.SDBL_RLS_SIGNAL_) AS SDBL_RLS_SIGNAL_,
  74. T18.Fld11497RRef AS Fld11497RRef,
  75. CAST(CAST(SUM(CASE WHEN T18.RecordKind_ = 0.0 THEN -T18.Fld11503_ ELSE T18.Fld11503_ END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2)) AS Fld11503Balance_
  76. FROM (SELECT
  77. CASE WHEN (EXISTS(SELECT
  78. 1
  79. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  80. LEFT OUTER JOIN dbo._Reference42 T20
  81. ON ((T19._Fld11496RRef = T20._IDRRef)) AND (T20._Fld595 = ?)
  82. WHERE EXISTS(SELECT
  83. 0x01 AS Q_001_F_000_
  84. FROM dbo._Reference98 T21
  85. INNER JOIN dbo._Reference21 T22
  86. ON (((T21._Fld1685 = ?) AND EXISTS(SELECT
  87. 0x01 AS Q_004_F_000_
  88. FROM dbo._InfoRg11709 T23
  89. WHERE ((T23._Fld595 = ?)) AND ((T23._Fld12065RRef = T21._IDRRef) AND (T23._Fld12066RRef = T22._IDRRef)))) AND T22._IDRRef IN
  90. (SELECT
  91. T24._Reference21_IDRRef AS Q_005_F_000RRef
  92. FROM dbo._Reference21_VT782 T24
  93. INNER JOIN dbo._InfoRg9937 T25
  94. ON ((T25._Fld9939_TYPE = 0x08 AND T25._Fld9939_RTRef = 0x00000095 AND T25._Fld9939_RRRef = ?) AND (T25._Fld9938_TYPE = T24._Fld784_TYPE AND T25._Fld9938_RTRef = T24._Fld784_RTRef AND T25._Fld9938_RRRef = T24._Fld784_RRRef))
  95. WHERE ((T24._Fld595 = ?)) AND (T25._Fld595 = ?)))
  96. WHERE ((T22._Fld595 = ?)) AND ((CASE WHEN T20._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T20._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  97. 0x01 AS Q_002_F_000_
  98. FROM dbo._InfoRg11710 T26
  99. WHERE ((T26._Fld595 = ?)) AND ((T26._Fld12072RRef = T22._IDRRef) AND (T26._Fld12073_TYPE = CASE WHEN T20._Fld12836RRef IS NOT NULL THEN 0x08 END AND T26._Fld12073_RTRef = CASE WHEN T20._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T26._Fld12073_RRRef = T20._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  100. 0x01 AS Q_003_F_000_
  101. FROM dbo._InfoRg11715 T27
  102. WHERE ((T27._Fld595 = ?)) AND ((T27._Fld12199RRef = T22._IDRRef) AND T27._Fld12200_TYPE = CASE WHEN T20._Fld12836RRef IS NOT NULL THEN 0x08 END AND T27._Fld12200_RTRef = CASE WHEN T20._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T27._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))))) THEN 0x01 ELSE 0x00 END AS SDBL_RLS_SIGNAL_,
  103. T19._Period AS Period_,
  104. T19._Fld11494RRef AS Fld11494RRef,
  105. T19._Fld11496RRef AS Fld11496RRef,
  106. T19._Fld595 AS Fld595_,
  107. T19._Fld11497RRef AS Fld11497RRef,
  108. T19._Fld11503 AS Fld11503_,
  109. T19._RecordKind AS RecordKind_,
  110. T19._Active AS Active_
  111. FROM dbo._AccumRg11493 T19
  112. WHERE (T19._Period >= ? AND T19._Period < ? AND T19._Fld11494RRef = ? AND T19._Fld11496RRef = ?) AND (T19._Fld595 = ?)) T18
  113. WHERE T18.Period_ >= ? AND T18.Period_ < ? AND T18.Active_ = 0x01 AND (((T18.Fld11494RRef = ?) AND (T18.Fld11496RRef = ?)))
  114. GROUP BY T18.Fld11497RRef
  115. HAVING (CAST(CAST(SUM(CASE WHEN T18.RecordKind_ = 0.0 THEN -T18.Fld11503_ ELSE T18.Fld11503_ END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2))) <> 0.0) T7
  116. GROUP BY T7.Fld11497RRef
  117. HAVING (CAST(SUM(T7.Fld11503Balance_) AS NUMERIC(38, 8))) <> 0.0) T6
  118. LEFT OUTER JOIN dbo._Reference43 T28
  119. ON (T6.Fld11497RRef = T28._IDRRef) AND (T28._Fld595 = ?)
  120. LEFT OUTER JOIN #tt T29 WITH(NOLOCK)
  121. ON (T28._Fld1083RRef = T29._Q_000_F_000RRef)
  122. ON CASE WHEN (T5._Q_001_F_000RRef = ?) THEN 0x01 ELSE CASE WHEN (T5._Q_001_F_000RRef = T6.Fld11497RRef) THEN 0x01 WHEN NOT (T5._Q_001_F_000RRef = T6.Fld11497RRef) THEN 0x00 END END = 0x01
  123. WHERE ((T5._Q_001_F_001RRef = ?)) AND CASE WHEN (T28._IDRRef = T28._IDRRef OR T28._IDRRef IS NULL) AND (T29._Q_000_F_000RRef = T29._Q_000_F_000RRef OR T29._Q_000_F_000RRef IS NULL) AND (T5._Q_001_F_001RRef = ?) THEN CASE WHEN ISNULL(T6.SDBL_RLS_SIGNAL_,0x01) = 0x01 THEN 0 ELSE 2000000000 END + 2000000000 ELSE 0 END = 2000000000
  124. GROUP BY T5._Q_001_F_001RRef,
  125. T5._Q_001_F_002,
  126. T5._Q_001_F_000RRef,
  127. T5._Q_001_F_003RRef
  128. UNION ALL SELECT
  129. T30._Q_001_F_001RRef,
  130. T30._Q_001_F_002,
  131. T30._Q_001_F_003RRef,
  132. CAST(SUM(ISNULL(CAST(CASE WHEN (T30._Q_001_F_000RRef = 0x00000000000000000000000000000000) THEN CAST(((CAST((CAST(T31.Fld11330Turnover_ AS NUMERIC(26, 2)) * CAST(T36._Q_000_F_001 AS NUMERIC(11, 6))) AS NUMERIC(29, 8)) * CAST(T30._Q_001_F_005 AS NUMERIC(8, 0))) / (T30._Q_001_F_004 * ISNULL(CAST(T36._Q_000_F_002 AS NUMERIC(10, 0)),1.0))) AS NUMERIC(15, 2)) ELSE T31.Fld11330Turnover_ END AS NUMERIC(33, 2)),0.0)) AS NUMERIC(38, 8)),
  133. T30._Q_001_F_000RRef
  134. FROM #tt T30 WITH(NOLOCK)
  135. LEFT OUTER JOIN (SELECT
  136. MIN(T32.SDBL_RLS_SIGNAL_) AS SDBL_RLS_SIGNAL_,
  137. T32.Fld11326RRef AS Fld11326RRef,
  138. CAST(SUM(T32.Fld11330Turnover_) AS NUMERIC(38, 8)) AS Fld11330Turnover_
  139. FROM (SELECT
  140. 0x01 AS SDBL_RLS_SIGNAL_,
  141. T33._Fld11326RRef AS Fld11326RRef,
  142. CAST(SUM(T33._Fld11330) AS NUMERIC(33, 8)) AS Fld11330Turnover_
  143. FROM dbo._AccumRgTn11332 T33
  144. WHERE ((T33._Fld595 = ?)) AND (T33._Period < ? AND (((T33._Fld11324RRef = ?) AND (T33._Fld11325RRef = ?))) AND (T33._Fld11330 <> ?))
  145. GROUP BY T33._Fld11326RRef
  146. HAVING (CAST(SUM(T33._Fld11330) AS NUMERIC(33, 8))) <> 0.0
  147. UNION ALL SELECT
  148. 0x01 AS SDBL_RLS_SIGNAL_,
  149. T34._Fld11326RRef AS Fld11326RRef,
  150. CAST(CAST(SUM(T34._Fld11330) AS NUMERIC(27, 8)) AS NUMERIC(27, 2)) AS Fld11330Turnover_
  151. FROM dbo._AccumRg11323 T34
  152. WHERE ((T34._Fld595 = ?)) AND (T34._Period >= ? AND T34._Period <= ? AND T34._Active = 0x01 AND (((T34._Fld11324RRef = ?) AND (T34._Fld11325RRef = ?))))
  153. GROUP BY T34._Fld11326RRef
  154. HAVING (CAST(CAST(SUM(T34._Fld11330) AS NUMERIC(27, 8)) AS NUMERIC(27, 2))) <> 0.0) T32
  155. GROUP BY T32.Fld11326RRef
  156. HAVING (CAST(SUM(T32.Fld11330Turnover_) AS NUMERIC(38, 8))) <> 0.0) T31
  157. LEFT OUTER JOIN dbo._Reference43 T35
  158. ON (T31.Fld11326RRef = T35._IDRRef) AND (T35._Fld595 = ?)
  159. LEFT OUTER JOIN #tt T36 WITH(NOLOCK)
  160. ON (T35._Fld1083RRef = T36._Q_000_F_000RRef)
  161. ON CASE WHEN (T30._Q_001_F_000RRef = ?) THEN 0x01 ELSE CASE WHEN (T30._Q_001_F_000RRef = T31.Fld11326RRef) THEN 0x01 WHEN NOT (T30._Q_001_F_000RRef = T31.Fld11326RRef) THEN 0x00 END END = 0x01
  162. WHERE (T30._Q_001_F_001RRef = ?)
  163. GROUP BY T30._Q_001_F_001RRef,
  164. T30._Q_001_F_002,
  165. T30._Q_001_F_000RRef,
  166. T30._Q_001_F_003RRef
  167. UNION ALL SELECT
  168. T37._Q_001_F_001RRef,
  169. T37._Q_001_F_002,
  170. T37._Q_001_F_003RRef,
  171. CAST(CAST(SUM(ISNULL(CAST(CAST(((CAST((CAST(T38.Fld11255Turnover_ AS NUMERIC(26, 2)) * CAST(T92._Q_000_F_001 AS NUMERIC(11, 6))) AS NUMERIC(29, 8)) * CAST(T37._Q_001_F_005 AS NUMERIC(8, 0))) / (T37._Q_001_F_004 * ISNULL(CAST(T92._Q_000_F_002 AS NUMERIC(10, 0)),1.0))) AS NUMERIC(15, 2)) AS NUMERIC(15, 2)),0.0)) AS NUMERIC(27, 8)) AS NUMERIC(38, 8)),
  172. T37._Q_001_F_000RRef
  173. FROM #tt T37 WITH(NOLOCK)
  174. LEFT OUTER JOIN (SELECT
  175. MIN(ISNULL(T39.SDBL_RLS_SIGNAL_,0x01)) AS SDBL_RLS_SIGNAL_,
  176. T39.Fld11251_TYPE AS Fld11251_TYPE,
  177. T39.Fld11251_RTRef AS Fld11251_RTRef,
  178. T39.Fld11251_RRRef AS Fld11251_RRRef,
  179. CAST(SUM(T39.Fld11255Turnover_) AS NUMERIC(38, 8)) AS Fld11255Turnover_
  180. FROM (SELECT
  181. MIN(CASE WHEN ISNULL(T42.SDBL_RLS_SIGNAL_,0x01) = 0x01 AND ISNULL(T52.SDBL_RLS_SIGNAL_,0x01) = 0x01 THEN 0x01 ELSE 0x00 END) AS SDBL_RLS_SIGNAL_,
  182. T40._Fld11251_TYPE AS Fld11251_TYPE,
  183. T40._Fld11251_RTRef AS Fld11251_RTRef,
  184. T40._Fld11251_RRRef AS Fld11251_RRRef,
  185. CAST(SUM(T40._Fld11255) AS NUMERIC(33, 8)) AS Fld11255Turnover_
  186. FROM dbo._AccumRgTn11257 T40
  187. LEFT OUTER JOIN dbo._Document218 T41
  188. ON (T40._Fld11251_TYPE = 0x08 AND T40._Fld11251_RTRef = 0x000000DA AND T40._Fld11251_RRRef = T41._IDRRef) AND (T41._Fld595 = ?)
  189. LEFT OUTER JOIN (SELECT
  190. CASE WHEN (EXISTS(SELECT
  191. 1
  192. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  193. LEFT OUTER JOIN dbo._Reference42 T44
  194. ON ((T43._Fld4625RRef = T44._IDRRef)) AND (T44._Fld595 = ?)
  195. WHERE EXISTS(SELECT
  196. 0x01 AS Q_001_F_000_
  197. FROM dbo._Reference98 T45
  198. INNER JOIN dbo._Reference21 T46
  199. ON (((T45._Fld1685 = ?) AND EXISTS(SELECT
  200. 0x01 AS Q_004_F_000_
  201. FROM dbo._InfoRg11709 T47
  202. WHERE ((T47._Fld595 = ?)) AND ((T47._Fld12065RRef = T45._IDRRef) AND (T47._Fld12066RRef = T46._IDRRef)))) AND T46._IDRRef IN
  203. (SELECT
  204. T48._Reference21_IDRRef AS Q_005_F_000RRef
  205. FROM dbo._Reference21_VT782 T48
  206. INNER JOIN dbo._InfoRg9937 T49
  207. ON ((T49._Fld9939_TYPE = 0x08 AND T49._Fld9939_RTRef = 0x00000095 AND T49._Fld9939_RRRef = ?) AND (T49._Fld9938_TYPE = T48._Fld784_TYPE AND T49._Fld9938_RTRef = T48._Fld784_RTRef AND T49._Fld9938_RRRef = T48._Fld784_RRRef))
  208. WHERE ((T48._Fld595 = ?)) AND (T49._Fld595 = ?)))
  209. WHERE ((T46._Fld595 = ?)) AND ((CASE WHEN T44._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  210. 0x01 AS Q_002_F_000_
  211. FROM dbo._InfoRg11710 T50
  212. WHERE ((T50._Fld595 = ?)) AND ((T50._Fld12072RRef = T46._IDRRef) AND (T50._Fld12073_TYPE = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END AND T50._Fld12073_RTRef = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T50._Fld12073_RRRef = T44._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  213. 0x01 AS Q_003_F_000_
  214. FROM dbo._InfoRg11715 T51
  215. WHERE ((T51._Fld595 = ?)) AND ((T51._Fld12199RRef = T46._IDRRef) AND T51._Fld12200_TYPE = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END AND T51._Fld12200_RTRef = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T51._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))))) THEN 0x01 ELSE 0x00 END AS SDBL_RLS_SIGNAL_,
  216. T43._IDRRef AS IDRRef,
  217. T43._Fld4625RRef AS Fld4625RRef,
  218. T43._Fld595 AS Fld595_
  219. FROM dbo._Document233 T43
  220. WHERE (T43._Fld595 = ?)) T42
  221. ON T40._Fld11251_TYPE = 0x08 AND T40._Fld11251_RTRef = 0x000000E9 AND T40._Fld11251_RRRef = T42.IDRRef
  222. LEFT OUTER JOIN (SELECT
  223. CASE WHEN (EXISTS(SELECT
  224. 1
  225. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  226. LEFT OUTER JOIN dbo._Reference42 T54
  227. ON ((T53._Fld4774RRef = T54._IDRRef)) AND (T54._Fld595 = ?)
  228. WHERE EXISTS(SELECT
  229. 0x01 AS Q_001_F_000_
  230. FROM dbo._Reference98 T55
  231. INNER JOIN dbo._Reference21 T56
  232. ON (((T55._Fld1685 = ?) AND EXISTS(SELECT
  233. 0x01 AS Q_006_F_000_
  234. FROM dbo._InfoRg11709 T57
  235. WHERE ((T57._Fld595 = ?)) AND ((T57._Fld12065RRef = T55._IDRRef) AND (T57._Fld12066RRef = T56._IDRRef)))) AND T56._IDRRef IN
  236. (SELECT
  237. T58._Reference21_IDRRef AS Q_007_F_000RRef
  238. FROM dbo._Reference21_VT782 T58
  239. INNER JOIN dbo._InfoRg9937 T59
  240. ON ((T59._Fld9939_TYPE = 0x08 AND T59._Fld9939_RTRef = 0x00000095 AND T59._Fld9939_RRRef = ?) AND (T59._Fld9938_TYPE = T58._Fld784_TYPE AND T59._Fld9938_RTRef = T58._Fld784_RTRef AND T59._Fld9938_RRRef = T58._Fld784_RRRef))
  241. WHERE ((T58._Fld595 = ?)) AND (T59._Fld595 = ?)))
  242. WHERE ((T56._Fld595 = ?)) AND ((0x08 <> 0x01) AND (CASE WHEN EXISTS(SELECT
  243. 0x01 AS Q_002_F_000_
  244. FROM dbo._InfoRg11710 T60
  245. WHERE ((T60._Fld595 = ?)) AND ((T60._Fld12072RRef = T56._IDRRef) AND (T60._Fld12073_TYPE = 0x08 AND T60._Fld12073_RTRef = 0x0000001C AND T60._Fld12073_RRRef = T53._Fld4779RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  246. 0x01 AS Q_003_F_000_
  247. FROM dbo._InfoRg11715 T61
  248. WHERE ((T61._Fld595 = ?)) AND ((T61._Fld12199RRef = T56._IDRRef) AND T61._Fld12200_TYPE = 0x08 AND T61._Fld12200_RTRef = 0x0000001C AND (T61._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END) AND (CASE WHEN T54._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T54._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  249. 0x01 AS Q_004_F_000_
  250. FROM dbo._InfoRg11710 T62
  251. WHERE ((T62._Fld595 = ?)) AND ((T62._Fld12072RRef = T56._IDRRef) AND (T62._Fld12073_TYPE = CASE WHEN T54._Fld12836RRef IS NOT NULL THEN 0x08 END AND T62._Fld12073_RTRef = CASE WHEN T54._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T62._Fld12073_RRRef = T54._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  252. 0x01 AS Q_005_F_000_
  253. FROM dbo._InfoRg11715 T63
  254. WHERE ((T63._Fld595 = ?)) AND ((T63._Fld12199RRef = T56._IDRRef) AND T63._Fld12200_TYPE = CASE WHEN T54._Fld12836RRef IS NOT NULL THEN 0x08 END AND T63._Fld12200_RTRef = CASE WHEN T54._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T63._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))))) THEN 0x01 ELSE 0x00 END AS SDBL_RLS_SIGNAL_,
  255. T53._IDRRef AS IDRRef,
  256. T53._Fld4774RRef AS Fld4774RRef,
  257. T53._Fld4779RRef AS Fld4779RRef,
  258. T53._Fld595 AS Fld595_
  259. FROM dbo._Document234 T53
  260. WHERE (T53._Fld595 = ?)) T52
  261. ON T40._Fld11251_TYPE = 0x08 AND T40._Fld11251_RTRef = 0x000000EA AND T40._Fld11251_RRRef = T52.IDRRef
  262. LEFT OUTER JOIN dbo._Document286 T64
  263. ON (T40._Fld11251_TYPE = 0x08 AND T40._Fld11251_RTRef = 0x0000011E AND T40._Fld11251_RRRef = T64._IDRRef) AND (T64._Fld595 = ?)
  264. LEFT OUTER JOIN dbo._Document199 T65
  265. ON (T40._Fld11251_TYPE = 0x08 AND T40._Fld11251_RTRef = 0x000000C7 AND T40._Fld11251_RRRef = T65._IDRRef) AND (T65._Fld595 = ?)
  266. WHERE ((T40._Fld595 = ?)) AND (T40._Period < ? AND (((T40._Fld11246RRef = ?) AND (CASE WHEN T40._Fld11251_TYPE = 0x08 AND T40._Fld11251_RTRef = 0x000000DA THEN T41._Fld4083RRef WHEN T40._Fld11251_TYPE = 0x08 AND T40._Fld11251_RTRef = 0x000000E9 THEN T42.Fld4625RRef WHEN T40._Fld11251_TYPE = 0x08 AND T40._Fld11251_RTRef = 0x000000EA THEN T52.Fld4774RRef WHEN T40._Fld11251_TYPE = 0x08 AND T40._Fld11251_RTRef = 0x0000011E THEN T64._Fld7289RRef WHEN T40._Fld11251_TYPE = 0x08 AND T40._Fld11251_RTRef = 0x000000C7 THEN T65._Fld2840RRef ELSE CAST(NULL AS BINARY(16)) END = ?))) AND (T40._Fld11255 <> ?))
  267. GROUP BY T40._Fld11251_TYPE,
  268. T40._Fld11251_RTRef,
  269. T40._Fld11251_RRRef
  270. HAVING (CAST(SUM(T40._Fld11255) AS NUMERIC(33, 8))) <> 0.0
  271. UNION ALL SELECT
  272. MIN(CASE WHEN ISNULL(T68.SDBL_RLS_SIGNAL_,0x01) = 0x01 AND ISNULL(T78.SDBL_RLS_SIGNAL_,0x01) = 0x01 THEN 0x01 ELSE 0x00 END) AS SDBL_RLS_SIGNAL_,
  273. T66._Fld11251_TYPE AS Fld11251_TYPE,
  274. T66._Fld11251_RTRef AS Fld11251_RTRef,
  275. T66._Fld11251_RRRef AS Fld11251_RRRef,
  276. CAST(CAST(SUM(T66._Fld11255) AS NUMERIC(27, 8)) AS NUMERIC(27, 2)) AS Fld11255Turnover_
  277. FROM dbo._AccumRg11245 T66
  278. LEFT OUTER JOIN dbo._Document218 T67
  279. ON (T66._Fld11251_TYPE = 0x08 AND T66._Fld11251_RTRef = 0x000000DA AND T66._Fld11251_RRRef = T67._IDRRef) AND (T67._Fld595 = ?)
  280. LEFT OUTER JOIN (SELECT
  281. CASE WHEN (EXISTS(SELECT
  282. 1
  283. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  284. LEFT OUTER JOIN dbo._Reference42 T70
  285. ON ((T69._Fld4625RRef = T70._IDRRef)) AND (T70._Fld595 = ?)
  286. WHERE EXISTS(SELECT
  287. 0x01 AS Q_001_F_000_
  288. FROM dbo._Reference98 T71
  289. INNER JOIN dbo._Reference21 T72
  290. ON (((T71._Fld1685 = ?) AND EXISTS(SELECT
  291. 0x01 AS Q_004_F_000_
  292. FROM dbo._InfoRg11709 T73
  293. WHERE ((T73._Fld595 = ?)) AND ((T73._Fld12065RRef = T71._IDRRef) AND (T73._Fld12066RRef = T72._IDRRef)))) AND T72._IDRRef IN
  294. (SELECT
  295. T74._Reference21_IDRRef AS Q_005_F_000RRef
  296. FROM dbo._Reference21_VT782 T74
  297. INNER JOIN dbo._InfoRg9937 T75
  298. ON ((T75._Fld9939_TYPE = 0x08 AND T75._Fld9939_RTRef = 0x00000095 AND T75._Fld9939_RRRef = ?) AND (T75._Fld9938_TYPE = T74._Fld784_TYPE AND T75._Fld9938_RTRef = T74._Fld784_RTRef AND T75._Fld9938_RRRef = T74._Fld784_RRRef))
  299. WHERE ((T74._Fld595 = ?)) AND (T75._Fld595 = ?)))
  300. WHERE ((T72._Fld595 = ?)) AND ((CASE WHEN T70._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T70._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  301. 0x01 AS Q_002_F_000_
  302. FROM dbo._InfoRg11710 T76
  303. WHERE ((T76._Fld595 = ?)) AND ((T76._Fld12072RRef = T72._IDRRef) AND (T76._Fld12073_TYPE = CASE WHEN T70._Fld12836RRef IS NOT NULL THEN 0x08 END AND T76._Fld12073_RTRef = CASE WHEN T70._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T76._Fld12073_RRRef = T70._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  304. 0x01 AS Q_003_F_000_
  305. FROM dbo._InfoRg11715 T77
  306. WHERE ((T77._Fld595 = ?)) AND ((T77._Fld12199RRef = T72._IDRRef) AND T77._Fld12200_TYPE = CASE WHEN T70._Fld12836RRef IS NOT NULL THEN 0x08 END AND T77._Fld12200_RTRef = CASE WHEN T70._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T77._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))))) THEN 0x01 ELSE 0x00 END AS SDBL_RLS_SIGNAL_,
  307. T69._IDRRef AS IDRRef,
  308. T69._Fld4625RRef AS Fld4625RRef,
  309. T69._Fld595 AS Fld595_
  310. FROM dbo._Document233 T69
  311. WHERE (T69._Fld595 = ?)) T68
  312. ON T66._Fld11251_TYPE = 0x08 AND T66._Fld11251_RTRef = 0x000000E9 AND T66._Fld11251_RRRef = T68.IDRRef
  313. LEFT OUTER JOIN (SELECT
  314. CASE WHEN (EXISTS(SELECT
  315. 1
  316. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  317. LEFT OUTER JOIN dbo._Reference42 T80
  318. ON ((T79._Fld4774RRef = T80._IDRRef)) AND (T80._Fld595 = ?)
  319. WHERE EXISTS(SELECT
  320. 0x01 AS Q_001_F_000_
  321. FROM dbo._Reference98 T81
  322. INNER JOIN dbo._Reference21 T82
  323. ON (((T81._Fld1685 = ?) AND EXISTS(SELECT
  324. 0x01 AS Q_006_F_000_
  325. FROM dbo._InfoRg11709 T83
  326. WHERE ((T83._Fld595 = ?)) AND ((T83._Fld12065RRef = T81._IDRRef) AND (T83._Fld12066RRef = T82._IDRRef)))) AND T82._IDRRef IN
  327. (SELECT
  328. T84._Reference21_IDRRef AS Q_007_F_000RRef
  329. FROM dbo._Reference21_VT782 T84
  330. INNER JOIN dbo._InfoRg9937 T85
  331. ON ((T85._Fld9939_TYPE = 0x08 AND T85._Fld9939_RTRef = 0x00000095 AND T85._Fld9939_RRRef = ?) AND (T85._Fld9938_TYPE = T84._Fld784_TYPE AND T85._Fld9938_RTRef = T84._Fld784_RTRef AND T85._Fld9938_RRRef = T84._Fld784_RRRef))
  332. WHERE ((T84._Fld595 = ?)) AND (T85._Fld595 = ?)))
  333. WHERE ((T82._Fld595 = ?)) AND ((0x08 <> 0x01) AND (CASE WHEN EXISTS(SELECT
  334. 0x01 AS Q_002_F_000_
  335. FROM dbo._InfoRg11710 T86
  336. WHERE ((T86._Fld595 = ?)) AND ((T86._Fld12072RRef = T82._IDRRef) AND (T86._Fld12073_TYPE = 0x08 AND T86._Fld12073_RTRef = 0x0000001C AND T86._Fld12073_RRRef = T79._Fld4779RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  337. 0x01 AS Q_003_F_000_
  338. FROM dbo._InfoRg11715 T87
  339. WHERE ((T87._Fld595 = ?)) AND ((T87._Fld12199RRef = T82._IDRRef) AND T87._Fld12200_TYPE = 0x08 AND T87._Fld12200_RTRef = 0x0000001C AND (T87._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END) AND (CASE WHEN T80._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T80._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  340. 0x01 AS Q_004_F_000_
  341. FROM dbo._InfoRg11710 T88
  342. WHERE ((T88._Fld595 = ?)) AND ((T88._Fld12072RRef = T82._IDRRef) AND (T88._Fld12073_TYPE = CASE WHEN T80._Fld12836RRef IS NOT NULL THEN 0x08 END AND T88._Fld12073_RTRef = CASE WHEN T80._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T88._Fld12073_RRRef = T80._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  343. 0x01 AS Q_005_F_000_
  344. FROM dbo._InfoRg11715 T89
  345. WHERE ((T89._Fld595 = ?)) AND ((T89._Fld12199RRef = T82._IDRRef) AND T89._Fld12200_TYPE = CASE WHEN T80._Fld12836RRef IS NOT NULL THEN 0x08 END AND T89._Fld12200_RTRef = CASE WHEN T80._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T89._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))))) THEN 0x01 ELSE 0x00 END AS SDBL_RLS_SIGNAL_,
  346. T79._IDRRef AS IDRRef,
  347. T79._Fld4774RRef AS Fld4774RRef,
  348. T79._Fld4779RRef AS Fld4779RRef,
  349. T79._Fld595 AS Fld595_
  350. FROM dbo._Document234 T79
  351. WHERE (T79._Fld595 = ?)) T78
  352. ON T66._Fld11251_TYPE = 0x08 AND T66._Fld11251_RTRef = 0x000000EA AND T66._Fld11251_RRRef = T78.IDRRef
  353. LEFT OUTER JOIN dbo._Document286 T90
  354. ON (T66._Fld11251_TYPE = 0x08 AND T66._Fld11251_RTRef = 0x0000011E AND T66._Fld11251_RRRef = T90._IDRRef) AND (T90._Fld595 = ?)
  355. LEFT OUTER JOIN dbo._Document199 T91
  356. ON (T66._Fld11251_TYPE = 0x08 AND T66._Fld11251_RTRef = 0x000000C7 AND T66._Fld11251_RRRef = T91._IDRRef) AND (T91._Fld595 = ?)
  357. WHERE ((T66._Fld595 = ?)) AND (T66._Period >= ? AND T66._Period <= ? AND T66._Active = 0x01 AND (((T66._Fld11246RRef = ?) AND (CASE WHEN T66._Fld11251_TYPE = 0x08 AND T66._Fld11251_RTRef = 0x000000DA THEN T67._Fld4083RRef WHEN T66._Fld11251_TYPE = 0x08 AND T66._Fld11251_RTRef = 0x000000E9 THEN T68.Fld4625RRef WHEN T66._Fld11251_TYPE = 0x08 AND T66._Fld11251_RTRef = 0x000000EA THEN T78.Fld4774RRef WHEN T66._Fld11251_TYPE = 0x08 AND T66._Fld11251_RTRef = 0x0000011E THEN T90._Fld7289RRef WHEN T66._Fld11251_TYPE = 0x08 AND T66._Fld11251_RTRef = 0x000000C7 THEN T91._Fld2840RRef ELSE CAST(NULL AS BINARY(16)) END = ?))))
  358. GROUP BY T66._Fld11251_TYPE,
  359. T66._Fld11251_RTRef,
  360. T66._Fld11251_RRRef
  361. HAVING (CAST(CAST(SUM(T66._Fld11255) AS NUMERIC(27, 8)) AS NUMERIC(27, 2))) <> 0.0) T39
  362. GROUP BY T39.Fld11251_TYPE,
  363. T39.Fld11251_RTRef,
  364. T39.Fld11251_RRRef
  365. HAVING (CAST(SUM(T39.Fld11255Turnover_) AS NUMERIC(38, 8))) <> 0.0) T38
  366. LEFT OUTER JOIN #tt T92 WITH(NOLOCK)
  367. ON (T92._Q_000_F_000RRef = ?)
  368. LEFT OUTER JOIN dbo._Document218 T93
  369. ON (T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000DA AND T38.Fld11251_RRRef = T93._IDRRef) AND (T93._Fld595 = ?)
  370. LEFT OUTER JOIN (SELECT
  371. CASE WHEN (EXISTS(SELECT
  372. 1
  373. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  374. LEFT OUTER JOIN dbo._Reference42 T96
  375. ON ((T95._Fld4625RRef = T96._IDRRef)) AND (T96._Fld595 = ?)
  376. WHERE EXISTS(SELECT
  377. 0x01 AS Q_001_F_000_
  378. FROM dbo._Reference98 T97
  379. INNER JOIN dbo._Reference21 T98
  380. ON (((T97._Fld1685 = ?) AND EXISTS(SELECT
  381. 0x01 AS Q_004_F_000_
  382. FROM dbo._InfoRg11709 T99
  383. WHERE ((T99._Fld595 = ?)) AND ((T99._Fld12065RRef = T97._IDRRef) AND (T99._Fld12066RRef = T98._IDRRef)))) AND T98._IDRRef IN
  384. (SELECT
  385. T100._Reference21_IDRRef AS Q_005_F_000RRef
  386. FROM dbo._Reference21_VT782 T100
  387. INNER JOIN dbo._InfoRg9937 T101
  388. ON ((T101._Fld9939_TYPE = 0x08 AND T101._Fld9939_RTRef = 0x00000095 AND T101._Fld9939_RRRef = ?) AND (T101._Fld9938_TYPE = T100._Fld784_TYPE AND T101._Fld9938_RTRef = T100._Fld784_RTRef AND T101._Fld9938_RRRef = T100._Fld784_RRRef))
  389. WHERE ((T100._Fld595 = ?)) AND (T101._Fld595 = ?)))
  390. WHERE ((T98._Fld595 = ?)) AND ((CASE WHEN T96._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T96._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  391. 0x01 AS Q_002_F_000_
  392. FROM dbo._InfoRg11710 T102
  393. WHERE ((T102._Fld595 = ?)) AND ((T102._Fld12072RRef = T98._IDRRef) AND (T102._Fld12073_TYPE = CASE WHEN T96._Fld12836RRef IS NOT NULL THEN 0x08 END AND T102._Fld12073_RTRef = CASE WHEN T96._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T102._Fld12073_RRRef = T96._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  394. 0x01 AS Q_003_F_000_
  395. FROM dbo._InfoRg11715 T103
  396. WHERE ((T103._Fld595 = ?)) AND ((T103._Fld12199RRef = T98._IDRRef) AND T103._Fld12200_TYPE = CASE WHEN T96._Fld12836RRef IS NOT NULL THEN 0x08 END AND T103._Fld12200_RTRef = CASE WHEN T96._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T103._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))))) THEN 0x01 ELSE 0x00 END AS SDBL_RLS_SIGNAL_,
  397. T95._IDRRef AS IDRRef,
  398. T95._Fld4625RRef AS Fld4625RRef,
  399. T95._Fld4627RRef AS Fld4627RRef,
  400. T95._Fld595 AS Fld595_
  401. FROM dbo._Document233 T95
  402. WHERE (T95._Fld595 = ?)) T94
  403. ON T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000E9 AND T38.Fld11251_RRRef = T94.IDRRef
  404. LEFT OUTER JOIN (SELECT
  405. CASE WHEN (EXISTS(SELECT
  406. 1
  407. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  408. LEFT OUTER JOIN dbo._Reference42 T106
  409. ON ((T105._Fld4774RRef = T106._IDRRef)) AND (T106._Fld595 = ?)
  410. WHERE EXISTS(SELECT
  411. 0x01 AS Q_001_F_000_
  412. FROM dbo._Reference98 T107
  413. INNER JOIN dbo._Reference21 T108
  414. ON (((T107._Fld1685 = ?) AND EXISTS(SELECT
  415. 0x01 AS Q_006_F_000_
  416. FROM dbo._InfoRg11709 T109
  417. WHERE ((T109._Fld595 = ?)) AND ((T109._Fld12065RRef = T107._IDRRef) AND (T109._Fld12066RRef = T108._IDRRef)))) AND T108._IDRRef IN
  418. (SELECT
  419. T110._Reference21_IDRRef AS Q_007_F_000RRef
  420. FROM dbo._Reference21_VT782 T110
  421. INNER JOIN dbo._InfoRg9937 T111
  422. ON ((T111._Fld9939_TYPE = 0x08 AND T111._Fld9939_RTRef = 0x00000095 AND T111._Fld9939_RRRef = ?) AND (T111._Fld9938_TYPE = T110._Fld784_TYPE AND T111._Fld9938_RTRef = T110._Fld784_RTRef AND T111._Fld9938_RRRef = T110._Fld784_RRRef))
  423. WHERE ((T110._Fld595 = ?)) AND (T111._Fld595 = ?)))
  424. WHERE ((T108._Fld595 = ?)) AND ((0x08 <> 0x01) AND (CASE WHEN EXISTS(SELECT
  425. 0x01 AS Q_002_F_000_
  426. FROM dbo._InfoRg11710 T112
  427. WHERE ((T112._Fld595 = ?)) AND ((T112._Fld12072RRef = T108._IDRRef) AND (T112._Fld12073_TYPE = 0x08 AND T112._Fld12073_RTRef = 0x0000001C AND T112._Fld12073_RRRef = T105._Fld4779RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  428. 0x01 AS Q_003_F_000_
  429. FROM dbo._InfoRg11715 T113
  430. WHERE ((T113._Fld595 = ?)) AND ((T113._Fld12199RRef = T108._IDRRef) AND T113._Fld12200_TYPE = 0x08 AND T113._Fld12200_RTRef = 0x0000001C AND (T113._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END) AND (CASE WHEN T106._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T106._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  431. 0x01 AS Q_004_F_000_
  432. FROM dbo._InfoRg11710 T114
  433. WHERE ((T114._Fld595 = ?)) AND ((T114._Fld12072RRef = T108._IDRRef) AND (T114._Fld12073_TYPE = CASE WHEN T106._Fld12836RRef IS NOT NULL THEN 0x08 END AND T114._Fld12073_RTRef = CASE WHEN T106._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T114._Fld12073_RRRef = T106._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  434. 0x01 AS Q_005_F_000_
  435. FROM dbo._InfoRg11715 T115
  436. WHERE ((T115._Fld595 = ?)) AND ((T115._Fld12199RRef = T108._IDRRef) AND T115._Fld12200_TYPE = CASE WHEN T106._Fld12836RRef IS NOT NULL THEN 0x08 END AND T115._Fld12200_RTRef = CASE WHEN T106._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T115._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))))) THEN 0x01 ELSE 0x00 END AS SDBL_RLS_SIGNAL_,
  437. T105._IDRRef AS IDRRef,
  438. T105._Fld4774RRef AS Fld4774RRef,
  439. T105._Fld4779RRef AS Fld4779RRef,
  440. T105._Fld595 AS Fld595_,
  441. T105._Fld4776RRef AS Fld4776RRef
  442. FROM dbo._Document234 T105
  443. WHERE (T105._Fld595 = ?)) T104
  444. ON T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000EA AND T38.Fld11251_RRRef = T104.IDRRef
  445. LEFT OUTER JOIN dbo._Document286 T116
  446. ON (T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x0000011E AND T38.Fld11251_RRRef = T116._IDRRef) AND (T116._Fld595 = ?)
  447. LEFT OUTER JOIN dbo._Document199 T117
  448. ON (T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000C7 AND T38.Fld11251_RRRef = T117._IDRRef) AND (T117._Fld595 = ?)
  449. ON CASE WHEN (T37._Q_001_F_000RRef = ?) THEN 0x01 ELSE CASE WHEN (T37._Q_001_F_000RRef = CASE WHEN T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000DA THEN T93._Fld4084RRef WHEN T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000E9 THEN T94.Fld4627RRef WHEN T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000EA THEN T104.Fld4776RRef WHEN T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x0000011E THEN T116._Fld7290RRef WHEN T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000C7 THEN T117._Fld2841RRef ELSE CAST(NULL AS BINARY(16)) END) THEN 0x01 WHEN NOT (T37._Q_001_F_000RRef = CASE WHEN T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000DA THEN T93._Fld4084RRef WHEN T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000E9 THEN T94.Fld4627RRef WHEN T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000EA THEN T104.Fld4776RRef WHEN T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x0000011E THEN T116._Fld7290RRef WHEN T38.Fld11251_TYPE = 0x08 AND T38.Fld11251_RTRef = 0x000000C7 THEN T117._Fld2841RRef ELSE CAST(NULL AS BINARY(16)) END) THEN 0x00 END END = 0x01
  450. WHERE ((T37._Q_001_F_001RRef = ?)) AND CASE WHEN (T116._IDRRef = T116._IDRRef OR T116._IDRRef IS NULL) AND (T117._IDRRef = T117._IDRRef OR T117._IDRRef IS NULL) AND (T92._Q_000_F_000RRef = T92._Q_000_F_000RRef OR T92._Q_000_F_000RRef IS NULL) AND (T93._IDRRef = T93._IDRRef OR T93._IDRRef IS NULL) AND (T37._Q_001_F_001RRef = ?) THEN CASE WHEN ISNULL(T38.SDBL_RLS_SIGNAL_,0x01) = 0x01 AND ISNULL(T94.SDBL_RLS_SIGNAL_,0x01) = 0x01 AND ISNULL(T104.SDBL_RLS_SIGNAL_,0x01) = 0x01 THEN 0 ELSE 2000000000 END + 2000000000 ELSE 0 END = 2000000000
  451. GROUP BY T37._Q_001_F_001RRef,
  452. T37._Q_001_F_002,
  453. T37._Q_001_F_000RRef,
  454. T37._Q_001_F_003RRef
  455. ",Context='Form.Call : Document.InventoryExpense.Form.DocumentForm.Module.GetCreditLimit
  456. ShajiAutoPaints_BIT Document.InventoryExpense.Form.DocumentForm.Form : 761 : QueryResult = Query.Execute();'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement