Advertisement
bytecoded

Top Query #3

Mar 12th, 2019
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 14.71 KB | None | 0 0
  1. SELECT TOP 25
  2. T1._IDRRef,
  3. T1._Marked,
  4. T1._Number,
  5. T1._Date_Time,
  6. T1._Posted,
  7. T1._Fld4621RRef,
  8. T1._Fld4622RRef,
  9. T1._Fld4625RRef,
  10. T1._Fld4633,
  11. T1._Fld4635RRef,
  12. T1._Fld4657RRef,
  13. CASE WHEN ((T1._Fld4657RRef = ?) AND T1._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T14.Fld10346Balance_ AS NUMERIC(33, 2)),0.0) > 0.0) THEN CASE WHEN (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 4.0 WHEN ((ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 6.0 ELSE 5.0 END ELSE CASE WHEN (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 0.0 WHEN ((ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 2.0 ELSE 1.0 END END ELSE 7.0 END,
  14. T19._Fld12313RRef,
  15. CASE WHEN ((ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) > 0.0) THEN (ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) ELSE 0.0 END,
  16. T30._Fld1191,
  17. T1._Fld4642
  18. FROM dbo._Document233 T1
  19. LEFT OUTER JOIN (SELECT
  20. T3._Fld11328RRef AS Fld11328RRef,
  21. CAST(SUM(T3._Fld11330) AS NUMERIC(33, 8)) AS Fld11330Turnover_
  22. FROM dbo._AccumRgTn11332 T3
  23. WHERE ((T3._Fld595 = ?)) AND (((T3._Fld11324RRef = ?)) AND (T3._Fld11330 <> ?))
  24. GROUP BY T3._Fld11328RRef
  25. HAVING (CAST(SUM(T3._Fld11330) AS NUMERIC(33, 8))) <> 0.0) T2
  26. ON (T1._IDRRef = T2.Fld11328RRef)
  27. LEFT OUTER JOIN (SELECT
  28. T5._Fld10540_TYPE AS Fld10540_TYPE,
  29. T5._Fld10540_RTRef AS Fld10540_RTRef,
  30. T5._Fld10540_RRRef AS Fld10540_RRRef,
  31. CAST(SUM(T5._Fld10545) AS NUMERIC(33, 8)) AS Fld10545Balance_
  32. FROM dbo._AccumRgT10549 T5
  33. WHERE (((T5._Fld595 = ?)) AND (EXISTS(SELECT
  34. 1
  35. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  36. LEFT OUTER JOIN dbo._Reference42 T6
  37. ON ((T5._Fld10538RRef = T6._IDRRef)) AND (T6._Fld595 = ?)
  38. WHERE EXISTS(SELECT
  39. 0x01 AS Q_001_F_000_
  40. FROM dbo._Reference98 T7
  41. INNER JOIN dbo._Reference21 T8
  42. ON (((T7._Fld1685 = ?) AND EXISTS(SELECT
  43. 0x01 AS Q_004_F_000_
  44. FROM dbo._InfoRg11709 T9
  45. WHERE ((T9._Fld595 = ?)) AND ((T9._Fld12065RRef = T7._IDRRef) AND (T9._Fld12066RRef = T8._IDRRef)))) AND T8._IDRRef IN
  46. (SELECT
  47. T10._Reference21_IDRRef AS Q_005_F_000RRef
  48. FROM dbo._Reference21_VT782 T10
  49. INNER JOIN dbo._InfoRg9937 T11
  50. ON ((T11._Fld9939_TYPE = 0x08 AND T11._Fld9939_RTRef = 0x00000095 AND T11._Fld9939_RRRef = ?) AND (T11._Fld9938_TYPE = T10._Fld784_TYPE AND T11._Fld9938_RTRef = T10._Fld784_RTRef AND T11._Fld9938_RRRef = T10._Fld784_RRRef))
  51. WHERE ((T10._Fld595 = ?)) AND (T11._Fld595 = ?)))
  52. WHERE ((T8._Fld595 = ?)) AND ((CASE WHEN T6._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T6._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  53. 0x01 AS Q_002_F_000_
  54. FROM dbo._InfoRg11710 T12
  55. WHERE ((T12._Fld595 = ?)) AND ((T12._Fld12072RRef = T8._IDRRef) AND (T12._Fld12073_TYPE = CASE WHEN T6._Fld12836RRef IS NOT NULL THEN 0x08 END AND T12._Fld12073_RTRef = CASE WHEN T6._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T12._Fld12073_RRRef = T6._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  56. 0x01 AS Q_003_F_000_
  57. FROM dbo._InfoRg11715 T13
  58. WHERE ((T13._Fld595 = ?)) AND ((T13._Fld12199RRef = T8._IDRRef) AND T13._Fld12200_TYPE = CASE WHEN T6._Fld12836RRef IS NOT NULL THEN 0x08 END AND T13._Fld12200_RTRef = CASE WHEN T6._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T13._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T5._Period = ? AND ((T5._Fld10536RRef = ?)) AND (T5._Fld10545 <> ?) AND (T5._Fld10545 <> ?))
  59. GROUP BY T5._Fld10540_TYPE,
  60. T5._Fld10540_RTRef,
  61. T5._Fld10540_RRRef
  62. HAVING (CAST(SUM(T5._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T4
  63. ON (0x08 = T4.Fld10540_TYPE AND 0x000000E9 = T4.Fld10540_RTRef AND T1._IDRRef = T4.Fld10540_RRRef)
  64. LEFT OUTER JOIN (SELECT
  65. T15.Fld10344RRef AS Fld10344RRef,
  66. CAST(SUM(T15.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
  67. FROM (SELECT
  68. T16._Fld10344RRef AS Fld10344RRef,
  69. CAST(SUM(T16._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
  70. FROM dbo._AccumRgT10349 T16
  71. WHERE ((T16._Fld595 = ?)) AND (T16._Period = ? AND ((T16._Fld10340RRef = ?)) AND (T16._Fld10346 <> ?) AND (T16._Fld10346 <> ?))
  72. GROUP BY T16._Fld10344RRef
  73. HAVING (CAST(SUM(T16._Fld10346) AS NUMERIC(33, 8))) <> 0.0
  74. UNION ALL SELECT
  75. T17._Fld10344RRef AS Fld10344RRef,
  76. CAST(CAST(SUM(CASE WHEN T17._RecordKind = 0.0 THEN -T17._Fld10346 ELSE T17._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2)) AS Fld10346Balance_
  77. FROM dbo._AccumRg10339 T17
  78. WHERE ((T17._Fld595 = ?)) AND (T17._Period >= ? AND T17._Period < ? AND T17._Active = 0x01 AND ((T17._Fld10340RRef = ?)))
  79. GROUP BY T17._Fld10344RRef
  80. HAVING (CAST(CAST(SUM(CASE WHEN T17._RecordKind = 0.0 THEN -T17._Fld10346 ELSE T17._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2))) <> 0.0) T15
  81. GROUP BY T15.Fld10344RRef
  82. HAVING (CAST(SUM(T15.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T14
  83. ON (T1._IDRRef = T14.Fld10344RRef)
  84. LEFT OUTER JOIN dbo._InfoRg9134 T18
  85. ON ((0x08 = T18._Fld9136_TYPE AND 0x000000E9 = T18._Fld9136_RTRef AND T1._IDRRef = T18._Fld9136_RRRef)) AND (T18._Fld595 = ?)
  86. LEFT OUTER JOIN dbo._InfoRg11720 T19
  87. ON ((0x08 = T19._Fld12312_TYPE AND 0x000000E9 = T19._Fld12312_RTRef AND T1._IDRRef = T19._Fld12312_RRRef)) AND (T19._Fld595 = ?)
  88. LEFT OUTER JOIN (SELECT
  89. T21._Fld10332_TYPE AS Fld10332_TYPE,
  90. T21._Fld10332_RTRef AS Fld10332_RTRef,
  91. T21._Fld10332_RRRef AS Fld10332_RRRef,
  92. CAST(SUM(T21._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
  93. FROM dbo._AccumRgT10337 T21
  94. WHERE (((T21._Fld595 = ?)) AND (EXISTS(SELECT
  95. 1
  96. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  97. LEFT OUTER JOIN dbo._Reference42 T22
  98. ON ((T21._Fld10330RRef = T22._IDRRef)) AND (T22._Fld595 = ?)
  99. WHERE EXISTS(SELECT
  100. 0x01 AS Q_001_F_000_
  101. FROM dbo._Reference98 T23
  102. INNER JOIN dbo._Reference21 T24
  103. ON (((T23._Fld1685 = ?) AND EXISTS(SELECT
  104. 0x01 AS Q_004_F_000_
  105. FROM dbo._InfoRg11709 T25
  106. WHERE ((T25._Fld595 = ?)) AND ((T25._Fld12065RRef = T23._IDRRef) AND (T25._Fld12066RRef = T24._IDRRef)))) AND T24._IDRRef IN
  107. (SELECT
  108. T26._Reference21_IDRRef AS Q_005_F_000RRef
  109. FROM dbo._Reference21_VT782 T26
  110. INNER JOIN dbo._InfoRg9937 T27
  111. ON ((T27._Fld9939_TYPE = 0x08 AND T27._Fld9939_RTRef = 0x00000095 AND T27._Fld9939_RRRef = ?) AND (T27._Fld9938_TYPE = T26._Fld784_TYPE AND T27._Fld9938_RTRef = T26._Fld784_RTRef AND T27._Fld9938_RRRef = T26._Fld784_RRRef))
  112. WHERE ((T26._Fld595 = ?)) AND (T27._Fld595 = ?)))
  113. WHERE ((T24._Fld595 = ?)) AND ((CASE WHEN T22._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T22._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  114. 0x01 AS Q_002_F_000_
  115. FROM dbo._InfoRg11710 T28
  116. WHERE ((T28._Fld595 = ?)) AND ((T28._Fld12072RRef = T24._IDRRef) AND (T28._Fld12073_TYPE = CASE WHEN T22._Fld12836RRef IS NOT NULL THEN 0x08 END AND T28._Fld12073_RTRef = CASE WHEN T22._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T28._Fld12073_RRRef = T22._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  117. 0x01 AS Q_003_F_000_
  118. FROM dbo._InfoRg11715 T29
  119. WHERE ((T29._Fld595 = ?)) AND ((T29._Fld12199RRef = T24._IDRRef) AND T29._Fld12200_TYPE = CASE WHEN T22._Fld12836RRef IS NOT NULL THEN 0x08 END AND T29._Fld12200_RTRef = CASE WHEN T22._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T29._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T21._Period = ? AND ((T21._Fld10328RRef = ?)) AND (T21._Fld10335 <> ?) AND (T21._Fld10335 <> ?))
  120. GROUP BY T21._Fld10332_TYPE,
  121. T21._Fld10332_RTRef,
  122. T21._Fld10332_RRRef
  123. HAVING (CAST(SUM(T21._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T20
  124. ON (0x08 = T20.Fld10332_TYPE AND 0x000000E9 = T20.Fld10332_RTRef AND T1._IDRRef = T20.Fld10332_RRRef)
  125. LEFT OUTER JOIN dbo._Reference51 T30
  126. ON (T1._Fld4635RRef = T30._IDRRef) AND (T30._Fld595 = ?)
  127. LEFT OUTER JOIN dbo._Reference28 T31
  128. ON (T1._Fld4621RRef = T31._IDRRef) AND (T31._Fld595 = ?)
  129. LEFT OUTER JOIN (SELECT
  130. T33._IDRRef AS IDRRef,
  131. T33._Fld12836RRef AS Fld12836RRef,
  132. T33._Fld595 AS Fld595_,
  133. T33._Folder AS Folder_,
  134. T33._Description COLLATE Latin1_General_CI_AS AS Description_
  135. FROM dbo._Reference42 T33
  136. WHERE ((((T33._Folder = 0x00) OR EXISTS(SELECT
  137. 0x01 AS Q_001_F_000_
  138. FROM dbo._Reference98 T34
  139. INNER JOIN dbo._Reference21 T35
  140. ON (((T34._Fld1685 = ?) AND EXISTS(SELECT
  141. 0x01 AS Q_004_F_000_
  142. FROM dbo._InfoRg11709 T36
  143. WHERE ((T36._Fld595 = ?)) AND ((T36._Fld12065RRef = T34._IDRRef) AND (T36._Fld12066RRef = T35._IDRRef)))) AND T35._IDRRef IN
  144. (SELECT
  145. T37._Reference21_IDRRef AS Q_005_F_000RRef
  146. FROM dbo._Reference21_VT782 T37
  147. INNER JOIN dbo._InfoRg9937 T38
  148. ON ((T38._Fld9939_TYPE = 0x08 AND T38._Fld9939_RTRef = 0x00000095 AND T38._Fld9939_RRRef = ?) AND (T38._Fld9938_TYPE = T37._Fld784_TYPE AND T38._Fld9938_RTRef = T37._Fld784_RTRef AND T38._Fld9938_RRRef = T37._Fld784_RRRef))
  149. WHERE ((T37._Fld595 = ?)) AND (T38._Fld595 = ?)))
  150. WHERE ((T35._Fld595 = ?)) AND ((CASE WHEN T33._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T33._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  151. 0x01 AS Q_002_F_000_
  152. FROM dbo._InfoRg11710 T39
  153. WHERE ((T39._Fld595 = ?)) AND ((T39._Fld12072RRef = T35._IDRRef) AND (T39._Fld12073_TYPE = CASE WHEN T33._Fld12836RRef IS NOT NULL THEN 0x08 END AND T39._Fld12073_RTRef = CASE WHEN T33._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T39._Fld12073_RRRef = T33._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  154. 0x01 AS Q_003_F_000_
  155. FROM dbo._InfoRg11715 T40
  156. WHERE ((T40._Fld595 = ?)) AND ((T40._Fld12199RRef = T35._IDRRef) AND T40._Fld12200_TYPE = CASE WHEN T33._Fld12836RRef IS NOT NULL THEN 0x08 END AND T40._Fld12200_RTRef = CASE WHEN T33._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T40._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T33._Fld595 = ?)) T32
  157. ON T1._Fld4625RRef = T32.IDRRef
  158. LEFT OUTER JOIN (SELECT
  159. T42._Number COLLATE Latin1_General_CI_AS AS Number_,
  160. T42._IDRRef AS IDRRef,
  161. T42._Fld5085RRef AS Fld5085RRef,
  162. T42._Fld595 AS Fld595_
  163. FROM dbo._Document240 T42
  164. WHERE ((EXISTS(SELECT
  165. 1
  166. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  167. LEFT OUTER JOIN dbo._Reference42 T43
  168. ON ((T42._Fld5085RRef = T43._IDRRef)) AND (T43._Fld595 = ?)
  169. WHERE EXISTS(SELECT
  170. 0x01 AS Q_001_F_000_
  171. FROM dbo._Reference98 T44
  172. INNER JOIN dbo._Reference21 T45
  173. ON (((T44._Fld1685 = ?) AND EXISTS(SELECT
  174. 0x01 AS Q_004_F_000_
  175. FROM dbo._InfoRg11709 T46
  176. WHERE ((T46._Fld595 = ?)) AND ((T46._Fld12065RRef = T44._IDRRef) AND (T46._Fld12066RRef = T45._IDRRef)))) AND T45._IDRRef IN
  177. (SELECT
  178. T47._Reference21_IDRRef AS Q_005_F_000RRef
  179. FROM dbo._Reference21_VT782 T47
  180. INNER JOIN dbo._InfoRg9937 T48
  181. ON ((T48._Fld9939_TYPE = 0x08 AND T48._Fld9939_RTRef = 0x00000095 AND T48._Fld9939_RRRef = ?) AND (T48._Fld9938_TYPE = T47._Fld784_TYPE AND T48._Fld9938_RTRef = T47._Fld784_RTRef AND T48._Fld9938_RRRef = T47._Fld784_RRRef))
  182. WHERE ((T47._Fld595 = ?)) AND (T48._Fld595 = ?)))
  183. WHERE ((T45._Fld595 = ?)) AND ((CASE WHEN T43._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T43._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  184. 0x01 AS Q_002_F_000_
  185. FROM dbo._InfoRg11710 T49
  186. WHERE ((T49._Fld595 = ?)) AND ((T49._Fld12072RRef = T45._IDRRef) AND (T49._Fld12073_TYPE = CASE WHEN T43._Fld12836RRef IS NOT NULL THEN 0x08 END AND T49._Fld12073_RTRef = CASE WHEN T43._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T49._Fld12073_RRRef = T43._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  187. 0x01 AS Q_003_F_000_
  188. FROM dbo._InfoRg11715 T50
  189. WHERE ((T50._Fld595 = ?)) AND ((T50._Fld12199RRef = T45._IDRRef) AND T50._Fld12200_TYPE = CASE WHEN T43._Fld12836RRef IS NOT NULL THEN 0x08 END AND T50._Fld12200_RTRef = CASE WHEN T43._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T50._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T42._Fld595 = ?)) T41
  190. ON T19._Fld12313RRef = T41.IDRRef
  191. WHERE (((T1._Fld595 = ?)) AND (EXISTS(SELECT
  192. 1
  193. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  194. LEFT OUTER JOIN dbo._Reference42 T51
  195. ON ((T1._Fld4625RRef = T51._IDRRef)) AND (T51._Fld595 = ?)
  196. WHERE EXISTS(SELECT
  197. 0x01 AS Q_001_F_000_
  198. FROM dbo._Reference98 T52
  199. INNER JOIN dbo._Reference21 T53
  200. ON (((T52._Fld1685 = ?) AND EXISTS(SELECT
  201. 0x01 AS Q_004_F_000_
  202. FROM dbo._InfoRg11709 T54
  203. WHERE ((T54._Fld595 = ?)) AND ((T54._Fld12065RRef = T52._IDRRef) AND (T54._Fld12066RRef = T53._IDRRef)))) AND T53._IDRRef IN
  204. (SELECT
  205. T55._Reference21_IDRRef AS Q_005_F_000RRef
  206. FROM dbo._Reference21_VT782 T55
  207. INNER JOIN dbo._InfoRg9937 T56
  208. ON ((T56._Fld9939_TYPE = 0x08 AND T56._Fld9939_RTRef = 0x00000095 AND T56._Fld9939_RRRef = ?) AND (T56._Fld9938_TYPE = T55._Fld784_TYPE AND T56._Fld9938_RTRef = T55._Fld784_RTRef AND T56._Fld9938_RRRef = T55._Fld784_RRRef))
  209. WHERE ((T55._Fld595 = ?)) AND (T56._Fld595 = ?)))
  210. WHERE ((T53._Fld595 = ?)) AND ((CASE WHEN T51._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T51._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  211. 0x01 AS Q_002_F_000_
  212. FROM dbo._InfoRg11710 T57
  213. WHERE ((T57._Fld595 = ?)) AND ((T57._Fld12072RRef = T53._IDRRef) AND (T57._Fld12073_TYPE = CASE WHEN T51._Fld12836RRef IS NOT NULL THEN 0x08 END AND T57._Fld12073_RTRef = CASE WHEN T51._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T57._Fld12073_RRRef = T51._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  214. 0x01 AS Q_003_F_000_
  215. FROM dbo._InfoRg11715 T58
  216. WHERE ((T58._Fld595 = ?)) AND ((T58._Fld12199RRef = T53._IDRRef) AND T58._Fld12200_TYPE = CASE WHEN T51._Fld12836RRef IS NOT NULL THEN 0x08 END AND T58._Fld12200_RTRef = CASE WHEN T51._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T58._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND ((T1._Fld4636RRef = ?) AND (T1._Fld4621RRef = ?) AND ((((((((T31._Description LIKE ? ESCAPE '/') OR (T32.Description_ LIKE ? ESCAPE '/')) OR ((T1._Fld4633 >= ?) AND (T1._Fld4633 < ?))) OR (T30._Description LIKE ? ESCAPE '/')) OR (T1._Number LIKE ? ESCAPE '/')) OR ((CASE WHEN ((ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),?) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) > ?) THEN (ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),?) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) ELSE ? END >= ?) AND (CASE WHEN ((ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),?) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) > ?) THEN (ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),?) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) ELSE ? END < ?))) OR (T1._Fld4642 LIKE ? ESCAPE '/')) OR (T41.Number_ LIKE ? ESCAPE '/')))
  217. ORDER BY (T1._Date_Time) DESC, (T1._IDRRef) DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement