Advertisement
bytecoded

Top Query #1

Mar 12th, 2019
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 60.79 KB | None | 0 0
  1. SELECT
  2. CASE WHEN (T1.SecondPeriod_ < {ts '4019-03-09 00:00:00'}) THEN 1.0 ELSE 2.0 END,
  3. CASE WHEN (T1.SecondPeriod_ < {ts '4019-03-09 00:00:00'}) THEN N'Total overdue payments' ELSE N'Total scheduled payments' END,
  4. T1.DayPeriod_,
  5. T1.SecondPeriod_,
  6. CASE WHEN T1.RecorderTRef = 0x00000112 THEN T8._Date_Time WHEN T1.RecorderTRef = 0x000000FD THEN T9._Date_Time WHEN T1.RecorderTRef = 0x000000D0 THEN T10._Date_Time WHEN T1.RecorderTRef = 0x000000CE THEN T11._Date_Time WHEN T1.RecorderTRef = 0x000000C8 THEN T12._Date_Time WHEN T1.RecorderTRef = 0x000000D9 THEN T13._Date_Time WHEN T1.RecorderTRef = 0x00000103 THEN T14._Date_Time WHEN T1.RecorderTRef = 0x000000D8 THEN T15._Date_Time WHEN T1.RecorderTRef = 0x000000D1 THEN T16._Date_Time WHEN T1.RecorderTRef = 0x000000F1 THEN T17._Date_Time WHEN T1.RecorderTRef = 0x00000104 THEN T18._Date_Time WHEN T1.RecorderTRef = 0x000000CD THEN T19._Date_Time WHEN T1.RecorderTRef = 0x000000CF THEN T20._Date_Time WHEN T1.RecorderTRef = 0x00000102 THEN T21._Date_Time WHEN T1.RecorderTRef = 0x000000D3 THEN T22._Date_Time WHEN T1.RecorderTRef = 0x0000010C THEN T23._Date_Time WHEN T1.RecorderTRef = 0x000000FF THEN T24._Date_Time WHEN T1.RecorderTRef = 0x000000D2 THEN T25._Date_Time WHEN T1.RecorderTRef = 0x0000010A THEN T26._Date_Time ELSE CAST(NULL AS DATETIME) END,
  7. T1.RecorderTRef,
  8. T1.RecorderRRef,
  9. T1.Fld11126RRef,
  10. T1.Fld11126RRef,
  11. T1.Fld11129_TYPE,
  12. T1.Fld11129_RTRef,
  13. T1.Fld11129_RRRef,
  14. T1.Fld11128RRef,
  15. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CASE WHEN T27._IDRRef IS NOT NULL THEN 0x08 END ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN CASE WHEN T28._IDRRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN CASE WHEN T29._IDRRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN CASE WHEN T30._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN CASE WHEN T31._IDRRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN CASE WHEN T32._IDRRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN CASE WHEN T33._IDRRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN CASE WHEN T34._IDRRef IS NOT NULL THEN 0x08 END ELSE CAST(NULL AS BINARY(1)) END END,
  16. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CASE WHEN T27._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN CASE WHEN T28._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN CASE WHEN T29._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN T30._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN CASE WHEN T31._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN CASE WHEN T32._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN CASE WHEN T33._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN CASE WHEN T34._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END ELSE CAST(NULL AS DATETIME) END END,
  17. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CASE WHEN T27._IDRRef IS NOT NULL THEN 0x00000025 END ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN CASE WHEN T28._IDRRef IS NOT NULL THEN 0x000000D0 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN CASE WHEN T29._IDRRef IS NOT NULL THEN 0x000000CE END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN CASE WHEN T30._Date_Time IS NOT NULL THEN 0x00000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN CASE WHEN T31._IDRRef IS NOT NULL THEN 0x000000F1 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN CASE WHEN T32._IDRRef IS NOT NULL THEN 0x000000CD END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN CASE WHEN T33._IDRRef IS NOT NULL THEN 0x0000010C END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN CASE WHEN T34._IDRRef IS NOT NULL THEN 0x0000010A END ELSE CAST(NULL AS BINARY(4)) END END,
  18. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN T27._IDRRef ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN T28._IDRRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN T29._IDRRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN CASE WHEN T30._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN T31._IDRRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN T32._IDRRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN T33._IDRRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN T34._IDRRef ELSE CAST(NULL AS BINARY(16)) END END,
  19. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN T27._Description ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN T28._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN T29._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN T30._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN T31._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN T32._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN T33._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN T34._Number ELSE CAST(NULL AS NVARCHAR(15)) END END,
  20. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CAST(NULL AS BINARY(1)) ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN CASE WHEN T28._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN CASE WHEN T29._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN CASE WHEN T30._Fld3883RRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN CASE WHEN T31._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN CASE WHEN T32._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN CASE WHEN T33._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN CASE WHEN T34._Date_Time IS NOT NULL THEN 0x04 END ELSE CAST(NULL AS BINARY(1)) END END,
  21. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CAST(NULL AS DATETIME) ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN T28._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN T29._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN CASE WHEN T30._Fld3883RRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN T31._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN T32._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN T33._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN T34._Date_Time ELSE CAST(NULL AS DATETIME) END END,
  22. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CAST(NULL AS BINARY(16)) ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN CASE WHEN T28._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN CASE WHEN T29._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN T30._Fld3883RRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN CASE WHEN T31._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN CASE WHEN T32._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN CASE WHEN T33._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN CASE WHEN T34._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END ELSE CAST(NULL AS BINARY(16)) END END,
  23. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN 3.0 ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN 2.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN 1.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN 7.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN 5.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN 0.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN 4.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN 6.0 ELSE -1.0 END END,
  24. T1.Fld11131RRef,
  25. 0x00,
  26. CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN 0x08 END ELSE 0x05 END,
  27. CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN N'' END ELSE N'' END,
  28. CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END ELSE 0x00000000000000000000000000000000 END,
  29. CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._Description WHEN T1.RecorderTRef = 0x000000D0 THEN T36._Description WHEN T1.RecorderTRef = 0x000000CE THEN T37._Description WHEN T1.RecorderTRef = 0x000000D9 THEN T38._Description WHEN T1.RecorderTRef = 0x00000103 THEN T39._Description WHEN T1.RecorderTRef = 0x000000D8 THEN T40._Description WHEN T1.RecorderTRef = 0x000000F1 THEN T41._Description WHEN T1.RecorderTRef = 0x000000CD THEN T42._Description WHEN T1.RecorderTRef = 0x000000CF THEN T43._Description WHEN T1.RecorderTRef = 0x00000102 THEN T44._Description WHEN T1.RecorderTRef = 0x000000D3 THEN T45._Description WHEN T1.RecorderTRef = 0x0000010C THEN T46._Description WHEN T1.RecorderTRef = 0x000000FF THEN T47._Description WHEN T1.RecorderTRef = 0x000000D2 THEN T48._Description WHEN T1.RecorderTRef = 0x0000010A THEN T49._Description ELSE CAST(NULL AS NVARCHAR(100)) END ELSE CAST(NULL AS NVARCHAR(100)) END,
  30. CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN 8.0 WHEN T1.RecorderTRef = 0x000000D0 THEN 8.0 WHEN T1.RecorderTRef = 0x000000CE THEN 8.0 WHEN T1.RecorderTRef = 0x000000D9 THEN 8.0 WHEN T1.RecorderTRef = 0x00000103 THEN 8.0 WHEN T1.RecorderTRef = 0x000000D8 THEN 8.0 WHEN T1.RecorderTRef = 0x000000F1 THEN 8.0 WHEN T1.RecorderTRef = 0x000000CD THEN 8.0 WHEN T1.RecorderTRef = 0x000000CF THEN 8.0 WHEN T1.RecorderTRef = 0x00000102 THEN 8.0 WHEN T1.RecorderTRef = 0x000000D3 THEN 8.0 WHEN T1.RecorderTRef = 0x0000010C THEN 8.0 WHEN T1.RecorderTRef = 0x000000FF THEN 8.0 WHEN T1.RecorderTRef = 0x000000D2 THEN 8.0 WHEN T1.RecorderTRef = 0x0000010A THEN 8.0 ELSE -1.0 END ELSE -1.0 END,
  31. T27._IDRRef,
  32. T27._Description,
  33. SUBSTRING(CASE WHEN T1.RecorderTRef = 0x00000112 THEN T8._Fld6868 WHEN T1.RecorderTRef = 0x000000FD THEN T9._Fld5720 WHEN T1.RecorderTRef = 0x000000D0 THEN T10._Fld3298 WHEN T1.RecorderTRef = 0x000000CE THEN T11._Fld3226 WHEN T1.RecorderTRef = 0x000000C8 THEN T12._Fld2920 WHEN T1.RecorderTRef = 0x000000D9 THEN T13._Fld4033 WHEN T1.RecorderTRef = 0x00000103 THEN T14._Fld6138 WHEN T1.RecorderTRef = 0x000000D8 THEN T15._Fld3844 WHEN T1.RecorderTRef = 0x000000D1 THEN T16._Fld3326 WHEN T1.RecorderTRef = 0x000000F1 THEN T17._Fld5129 WHEN T1.RecorderTRef = 0x00000104 THEN T18._Fld6221 WHEN T1.RecorderTRef = 0x000000CD THEN T19._Fld3195 WHEN T1.RecorderTRef = 0x000000CF THEN T20._Fld3272 WHEN T1.RecorderTRef = 0x00000102 THEN T21._Fld6050 WHEN T1.RecorderTRef = 0x000000D3 THEN T22._Fld3437 WHEN T1.RecorderTRef = 0x0000010C THEN T23._Fld6577 WHEN T1.RecorderTRef = 0x000000FF THEN T24._Fld5854 WHEN T1.RecorderTRef = 0x000000D2 THEN T25._Fld3342 WHEN T1.RecorderTRef = 0x0000010A THEN T26._Fld6469 ELSE CAST(NULL AS NVARCHAR(MAX)) END, CAST(1.0 AS INT), CAST(100.0 AS INT)),
  34. N'Total payments',
  35. SUBSTRING(N'', CAST(1.0 AS INT), CAST(200.0 AS INT)),
  36. MAX(T1.Fld11132Turnover_),
  37. CAST(SUM(ISNULL(CAST(T3.Fld11132Turnover_ AS NUMERIC(21, 2)),0.0)) AS NUMERIC(33, 8)),
  38. MAX(ISNULL(CAST(T5.Fld11133Turnover_ AS NUMERIC(21, 2)),0.0)),
  39. CASE WHEN (MAX((T1.Fld11132Turnover_ + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0))) > 0.0) THEN CASE WHEN ((CAST(SUM((ISNULL(CAST(T3.Fld11132Turnover_ AS NUMERIC(21, 2)),0.0) + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0))) AS NUMERIC(38, 8)) - MAX(ISNULL(CAST(T5.Fld11133Turnover_ AS NUMERIC(21, 2)),0.0))) >= 0.0) THEN MAX((T1.Fld11132Turnover_ + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0))) WHEN (((CAST(SUM((ISNULL(CAST(T3.Fld11132Turnover_ AS NUMERIC(21, 2)),0.0) + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0))) AS NUMERIC(38, 8)) + MAX((T1.Fld11132Turnover_ + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0)))) - MAX(ISNULL(CAST(T5.Fld11133Turnover_ AS NUMERIC(21, 2)),0.0))) < 0.0) THEN 0.0 ELSE ((CAST(SUM((ISNULL(CAST(T3.Fld11132Turnover_ AS NUMERIC(21, 2)),0.0) + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0))) AS NUMERIC(38, 8)) + MAX((T1.Fld11132Turnover_ + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0)))) - MAX(ISNULL(CAST(T5.Fld11133Turnover_ AS NUMERIC(21, 2)),0.0))) END ELSE CASE WHEN ((CAST(SUM((ISNULL(CAST(T3.Fld11132Turnover_ AS NUMERIC(21, 2)),0.0) + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0))) AS NUMERIC(38, 8)) - MAX(ISNULL(CAST(T5.Fld11133Turnover_ AS NUMERIC(21, 2)),0.0))) <= 0.0) THEN MAX((T1.Fld11132Turnover_ + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0))) WHEN (((CAST(SUM((ISNULL(CAST(T3.Fld11132Turnover_ AS NUMERIC(21, 2)),0.0) + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0))) AS NUMERIC(38, 8)) + MAX((T1.Fld11132Turnover_ + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0)))) - MAX(ISNULL(CAST(T5.Fld11133Turnover_ AS NUMERIC(21, 2)),0.0))) > 0.0) THEN 0.0 ELSE ((CAST(SUM((ISNULL(CAST(T3.Fld11132Turnover_ AS NUMERIC(21, 2)),0.0) + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0))) AS NUMERIC(38, 8)) + MAX((T1.Fld11132Turnover_ + ISNULL(CAST(T7._Q_000_F_001 AS NUMERIC(27, 2)),0.0)))) - MAX(ISNULL(CAST(T5.Fld11133Turnover_ AS NUMERIC(21, 2)),0.0))) END END,
  40. MAX(CASE WHEN ((T1.RecorderTRef = 0x000000D0) AND (T1.Fld11132Turnover_ < 0.0)) THEN -(T1.Fld11132Turnover_) ELSE T1.Fld11132Turnover_ END),
  41. 0.0,
  42. 0.0,
  43. 0.0,
  44. 0.0,
  45. 0.0,
  46. 0.0,
  47. 0.0,
  48. 0.0
  49. FROM (SELECT
  50. T2._RecorderTRef AS RecorderTRef,
  51. T2._RecorderRRef AS RecorderRRef,
  52. T2._Period AS SecondPeriod_,
  53. DATEADD(DAY,CAST(DATEPART(DAY,T2._Period) AS NUMERIC(4)) - 1,DATEADD(MONTH,CAST(DATEPART(MONTH,T2._Period) AS NUMERIC(4)) - 1,DATEADD(YEAR,(CAST(DATEPART(YEAR,T2._Period) AS NUMERIC(4)) - 2000) - 2000,{ts '4000-01-01 00:00:00'}))) AS DayPeriod_,
  54. T2._Fld11131RRef AS Fld11131RRef,
  55. T2._Fld11128RRef AS Fld11128RRef,
  56. T2._Fld11130_TYPE AS Fld11130_TYPE,
  57. T2._Fld11130_RTRef AS Fld11130_RTRef,
  58. T2._Fld11130_RRRef AS Fld11130_RRRef,
  59. T2._Fld11126RRef AS Fld11126RRef,
  60. T2._Fld11129_TYPE AS Fld11129_TYPE,
  61. T2._Fld11129_RTRef AS Fld11129_RTRef,
  62. T2._Fld11129_RRRef AS Fld11129_RRRef,
  63. T2._Fld11127RRef AS Fld11127RRef,
  64. CAST(SUM(T2._Fld11132) AS NUMERIC(27, 8)) AS Fld11132Turnover_
  65. FROM dbo._AccumRg11124 T2
  66. WHERE ((T2._Fld595 = ?)) AND (T2._Period >= ? AND T2._Period <= ? AND T2._Active = 0x01 AND (((T2._Fld11125RRef = ?) AND (T2._Fld11131RRef = ?))))
  67. GROUP BY T2._RecorderTRef,
  68. T2._RecorderRRef,
  69. T2._Period,
  70. DATEADD(DAY,CAST(DATEPART(DAY,T2._Period) AS NUMERIC(4)) - 1,DATEADD(MONTH,CAST(DATEPART(MONTH,T2._Period) AS NUMERIC(4)) - 1,DATEADD(YEAR,(CAST(DATEPART(YEAR,T2._Period) AS NUMERIC(4)) - 2000) - 2000,{ts '4000-01-01 00:00:00'}))),
  71. T2._Fld11131RRef,
  72. T2._Fld11128RRef,
  73. T2._Fld11130_TYPE,
  74. T2._Fld11130_RTRef,
  75. T2._Fld11130_RRRef,
  76. T2._Fld11126RRef,
  77. T2._Fld11129_TYPE,
  78. T2._Fld11129_RTRef,
  79. T2._Fld11129_RRRef,
  80. T2._Fld11127RRef
  81. HAVING (CAST(SUM(T2._Fld11132) AS NUMERIC(27, 8))) <> 0.0) T1
  82. LEFT OUTER JOIN (SELECT
  83. T4._RecorderTRef AS RecorderTRef,
  84. T4._RecorderRRef AS RecorderRRef,
  85. T4._Period AS SecondPeriod_,
  86. T4._Fld11130_TYPE AS Fld11130_TYPE,
  87. T4._Fld11130_RTRef AS Fld11130_RTRef,
  88. T4._Fld11130_RRRef AS Fld11130_RRRef,
  89. T4._Fld11127RRef AS Fld11127RRef,
  90. CAST(SUM(T4._Fld11132) AS NUMERIC(27, 8)) AS Fld11132Turnover_
  91. FROM dbo._AccumRg11124 T4
  92. WHERE ((T4._Fld595 = ?)) AND (T4._Period >= ? AND T4._Period <= ? AND T4._Active = 0x01 AND (((T4._Fld11125RRef = ?) AND (T4._Fld11131RRef = ?))))
  93. GROUP BY T4._RecorderTRef,
  94. T4._RecorderRRef,
  95. T4._Period,
  96. T4._Fld11130_TYPE,
  97. T4._Fld11130_RTRef,
  98. T4._Fld11130_RRRef,
  99. T4._Fld11127RRef
  100. HAVING (CAST(SUM(T4._Fld11132) AS NUMERIC(27, 8))) <> 0.0) T3
  101. ON (((T1.SecondPeriod_ > T3.SecondPeriod_) OR ((T1.SecondPeriod_ = T3.SecondPeriod_) AND ((T1.RecorderTRef > T3.RecorderTRef OR T1.RecorderTRef = T3.RecorderTRef AND T1.RecorderRRef > T3.RecorderRRef)))) AND CASE WHEN ((((((((T3.Fld11130_TYPE = 0x01 AND T3.Fld11130_RTRef = 0x00000000 AND T3.Fld11130_RRRef = ?) OR (T3.Fld11130_TYPE = 0x08 AND T3.Fld11130_RTRef = 0x000000F1 AND T3.Fld11130_RRRef = ?)) OR (T3.Fld11130_TYPE = 0x08 AND T3.Fld11130_RTRef = 0x0000010A AND T3.Fld11130_RRRef = ?)) OR (T3.Fld11130_TYPE = 0x08 AND T3.Fld11130_RTRef = 0x000000D8 AND T3.Fld11130_RRRef = ?)) OR (T3.Fld11130_TYPE = 0x08 AND T3.Fld11130_RTRef = 0x0000010C AND T3.Fld11130_RRRef = ?)) AND (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = ?) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = ?)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = ?)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = ?)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = ?))) AND (T3.Fld11127RRef <> ?)) AND (T3.Fld11127RRef = T1.Fld11127RRef)) THEN 0x01 WHEN ((((((T3.Fld11130_TYPE <> 0x01) AND (((T3.Fld11130_TYPE <> 0x08 OR T3.Fld11130_RTRef <> 0x000000F1 OR T3.Fld11130_RRRef <> ?)))) AND (((T3.Fld11130_TYPE <> 0x08 OR T3.Fld11130_RTRef <> 0x0000010A OR T3.Fld11130_RRRef <> ?)))) AND (((T3.Fld11130_TYPE <> 0x08 OR T3.Fld11130_RTRef <> 0x000000D8 OR T3.Fld11130_RRRef <> ?)))) AND (((T3.Fld11130_TYPE <> 0x08 OR T3.Fld11130_RTRef <> 0x0000010C OR T3.Fld11130_RRRef <> ?)))) AND (T1.Fld11130_TYPE = T3.Fld11130_TYPE AND T1.Fld11130_RTRef = T3.Fld11130_RTRef AND T1.Fld11130_RRRef = T3.Fld11130_RRRef)) THEN 0x01 ELSE 0x00 END = 0x01)
  102. LEFT OUTER JOIN (SELECT
  103. T6._Fld11130_TYPE AS Fld11130_TYPE,
  104. T6._Fld11130_RTRef AS Fld11130_RTRef,
  105. T6._Fld11130_RRRef AS Fld11130_RRRef,
  106. T6._Fld11127RRef AS Fld11127RRef,
  107. CAST(SUM(T6._Fld11133) AS NUMERIC(27, 8)) AS Fld11133Turnover_
  108. FROM dbo._AccumRg11124 T6
  109. WHERE ((T6._Fld595 = ?)) AND (T6._Period >= ? AND T6._Period <= ? AND T6._Active = 0x01 AND (((T6._Fld11125RRef = ?) AND (T6._Fld11131RRef = ?))))
  110. GROUP BY T6._Fld11130_TYPE,
  111. T6._Fld11130_RTRef,
  112. T6._Fld11130_RRRef,
  113. T6._Fld11127RRef
  114. HAVING (CAST(SUM(T6._Fld11133) AS NUMERIC(27, 8))) <> 0.0) T5
  115. ON ((T1.Fld11131RRef = ?) AND CASE WHEN ((((((((T5.Fld11130_TYPE = 0x01 AND T5.Fld11130_RTRef = 0x00000000 AND T5.Fld11130_RRRef = ?) OR (T5.Fld11130_TYPE = 0x08 AND T5.Fld11130_RTRef = 0x000000F1 AND T5.Fld11130_RRRef = ?)) OR (T5.Fld11130_TYPE = 0x08 AND T5.Fld11130_RTRef = 0x0000010A AND T5.Fld11130_RRRef = ?)) OR (T5.Fld11130_TYPE = 0x08 AND T5.Fld11130_RTRef = 0x000000D8 AND T5.Fld11130_RRRef = ?)) OR (T5.Fld11130_TYPE = 0x08 AND T5.Fld11130_RTRef = 0x0000010C AND T5.Fld11130_RRRef = ?)) AND (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = ?) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = ?)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = ?)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = ?)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = ?))) AND (T5.Fld11127RRef <> ?)) AND (T5.Fld11127RRef = T1.Fld11127RRef)) THEN 0x01 WHEN ((((((T5.Fld11130_TYPE <> 0x01) AND (((T5.Fld11130_TYPE <> 0x08 OR T5.Fld11130_RTRef <> 0x000000F1 OR T5.Fld11130_RRRef <> ?)))) AND (((T5.Fld11130_TYPE <> 0x08 OR T5.Fld11130_RTRef <> 0x0000010A OR T5.Fld11130_RRRef <> ?)))) AND (((T5.Fld11130_TYPE <> 0x08 OR T5.Fld11130_RTRef <> 0x000000D8 OR T5.Fld11130_RRRef <> ?)))) AND (((T5.Fld11130_TYPE <> 0x08 OR T5.Fld11130_RTRef <> 0x0000010C OR T5.Fld11130_RRRef <> ?)))) AND (T1.Fld11130_TYPE = T5.Fld11130_TYPE AND T1.Fld11130_RTRef = T5.Fld11130_RTRef AND T1.Fld11130_RRRef = T5.Fld11130_RRRef)) THEN 0x01 ELSE 0x00 END = 0x01)
  116. LEFT OUTER JOIN #tt T7 WITH(NOLOCK)
  117. ON (0x08 = T7._Q_000_F_000_TYPE AND T1.RecorderTRef = T7._Q_000_F_000_RTRef AND T1.RecorderRRef = T7._Q_000_F_000_RRRef)
  118. LEFT OUTER JOIN dbo._Document274 T8
  119. ON (T1.RecorderTRef = 0x00000112 AND T1.RecorderRRef = T8._IDRRef) AND (T8._Fld595 = ?)
  120. LEFT OUTER JOIN dbo._Document253 T9
  121. ON (T1.RecorderTRef = 0x000000FD AND T1.RecorderRRef = T9._IDRRef) AND (T9._Fld595 = ?)
  122. LEFT OUTER JOIN dbo._Document208 T10
  123. ON (T1.RecorderTRef = 0x000000D0 AND T1.RecorderRRef = T10._IDRRef) AND (T10._Fld595 = ?)
  124. LEFT OUTER JOIN dbo._Document206 T11
  125. ON (T1.RecorderTRef = 0x000000CE AND T1.RecorderRRef = T11._IDRRef) AND (T11._Fld595 = ?)
  126. LEFT OUTER JOIN dbo._Document200 T12
  127. ON (T1.RecorderTRef = 0x000000C8 AND T1.RecorderRRef = T12._IDRRef) AND (T12._Fld595 = ?)
  128. LEFT OUTER JOIN dbo._Document217 T13
  129. ON (T1.RecorderTRef = 0x000000D9 AND T1.RecorderRRef = T13._IDRRef) AND (T13._Fld595 = ?)
  130. LEFT OUTER JOIN dbo._Document259 T14
  131. ON (T1.RecorderTRef = 0x00000103 AND T1.RecorderRRef = T14._IDRRef) AND (T14._Fld595 = ?)
  132. LEFT OUTER JOIN dbo._Document216 T15
  133. ON (T1.RecorderTRef = 0x000000D8 AND T1.RecorderRRef = T15._IDRRef) AND (T15._Fld595 = ?)
  134. LEFT OUTER JOIN dbo._Document209 T16
  135. ON (T1.RecorderTRef = 0x000000D1 AND T1.RecorderRRef = T16._IDRRef) AND (T16._Fld595 = ?)
  136. LEFT OUTER JOIN dbo._Document241 T17
  137. ON (T1.RecorderTRef = 0x000000F1 AND T1.RecorderRRef = T17._IDRRef) AND (T17._Fld595 = ?)
  138. LEFT OUTER JOIN dbo._Document260 T18
  139. ON (T1.RecorderTRef = 0x00000104 AND T1.RecorderRRef = T18._IDRRef) AND (T18._Fld595 = ?)
  140. LEFT OUTER JOIN dbo._Document205 T19
  141. ON (T1.RecorderTRef = 0x000000CD AND T1.RecorderRRef = T19._IDRRef) AND (T19._Fld595 = ?)
  142. LEFT OUTER JOIN dbo._Document207 T20
  143. ON (T1.RecorderTRef = 0x000000CF AND T1.RecorderRRef = T20._IDRRef) AND (T20._Fld595 = ?)
  144. LEFT OUTER JOIN dbo._Document258 T21
  145. ON (T1.RecorderTRef = 0x00000102 AND T1.RecorderRRef = T21._IDRRef) AND (T21._Fld595 = ?)
  146. LEFT OUTER JOIN dbo._Document211 T22
  147. ON (T1.RecorderTRef = 0x000000D3 AND T1.RecorderRRef = T22._IDRRef) AND (T22._Fld595 = ?)
  148. LEFT OUTER JOIN dbo._Document268 T23
  149. ON (T1.RecorderTRef = 0x0000010C AND T1.RecorderRRef = T23._IDRRef) AND (T23._Fld595 = ?)
  150. LEFT OUTER JOIN dbo._Document255 T24
  151. ON (T1.RecorderTRef = 0x000000FF AND T1.RecorderRRef = T24._IDRRef) AND (T24._Fld595 = ?)
  152. LEFT OUTER JOIN dbo._Document210 T25
  153. ON (T1.RecorderTRef = 0x000000D2 AND T1.RecorderRRef = T25._IDRRef) AND (T25._Fld595 = ?)
  154. LEFT OUTER JOIN dbo._Document266 T26
  155. ON (T1.RecorderTRef = 0x0000010A AND T1.RecorderRRef = T26._IDRRef) AND (T26._Fld595 = ?)
  156. LEFT OUTER JOIN dbo._Reference37 T27
  157. ON (T1.Fld11127RRef = T27._IDRRef) AND (T27._Fld595 = ?)
  158. LEFT OUTER JOIN dbo._Document208 T28
  159. ON (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 AND T1.Fld11130_RRRef = T28._IDRRef) AND (T28._Fld595 = ?)
  160. LEFT OUTER JOIN dbo._Document206 T29
  161. ON (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE AND T1.Fld11130_RRRef = T29._IDRRef) AND (T29._Fld595 = ?)
  162. LEFT OUTER JOIN dbo._Document216 T30
  163. ON (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = T30._IDRRef) AND (T30._Fld595 = ?)
  164. LEFT OUTER JOIN dbo._Document241 T31
  165. ON (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = T31._IDRRef) AND (T31._Fld595 = ?)
  166. LEFT OUTER JOIN dbo._Document205 T32
  167. ON (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD AND T1.Fld11130_RRRef = T32._IDRRef) AND (T32._Fld595 = ?)
  168. LEFT OUTER JOIN dbo._Document268 T33
  169. ON (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = T33._IDRRef) AND (T33._Fld595 = ?)
  170. LEFT OUTER JOIN dbo._Document266 T34
  171. ON (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = T34._IDRRef) AND (T34._Fld595 = ?)
  172. LEFT OUTER JOIN dbo._Reference42 T35
  173. ON (T9._Fld5721RRef = T35._IDRRef) AND (T35._Fld595 = ?)
  174. LEFT OUTER JOIN dbo._Reference42 T36
  175. ON (T10._Fld3314RRef = T36._IDRRef) AND (T36._Fld595 = ?)
  176. LEFT OUTER JOIN dbo._Reference42 T37
  177. ON (T11._Fld3236RRef = T37._IDRRef) AND (T37._Fld595 = ?)
  178. LEFT OUTER JOIN dbo._Reference42 T38
  179. ON (T13._Fld4026RRef = T38._IDRRef) AND (T38._Fld595 = ?)
  180. LEFT OUTER JOIN dbo._Reference42 T39
  181. ON (T14._Fld6139RRef = T39._IDRRef) AND (T39._Fld595 = ?)
  182. LEFT OUTER JOIN dbo._Reference42 T40
  183. ON (T15._Fld3845RRef = T40._IDRRef) AND (T40._Fld595 = ?)
  184. LEFT OUTER JOIN dbo._Reference42 T41
  185. ON (T17._Fld5131RRef = T41._IDRRef) AND (T41._Fld595 = ?)
  186. LEFT OUTER JOIN dbo._Reference42 T42
  187. ON (T19._Fld3206RRef = T42._IDRRef) AND (T42._Fld595 = ?)
  188. LEFT OUTER JOIN dbo._Reference42 T43
  189. ON (T20._Fld3273RRef = T43._IDRRef) AND (T43._Fld595 = ?)
  190. LEFT OUTER JOIN dbo._Reference42 T44
  191. ON (T21._Fld6051RRef = T44._IDRRef) AND (T44._Fld595 = ?)
  192. LEFT OUTER JOIN dbo._Reference42 T45
  193. ON (T22._Fld3438RRef = T45._IDRRef) AND (T45._Fld595 = ?)
  194. LEFT OUTER JOIN dbo._Reference42 T46
  195. ON (T23._Fld6560RRef = T46._IDRRef) AND (T46._Fld595 = ?)
  196. LEFT OUTER JOIN dbo._Reference42 T47
  197. ON (T24._Fld5855RRef = T47._IDRRef) AND (T47._Fld595 = ?)
  198. LEFT OUTER JOIN dbo._Reference42 T48
  199. ON (T25._Fld3343RRef = T48._IDRRef) AND (T48._Fld595 = ?)
  200. LEFT OUTER JOIN dbo._Reference42 T49
  201. ON (T26._Fld6471RRef = T49._IDRRef) AND (T49._Fld595 = ?)
  202. WHERE (NOT (((T1.RecorderTRef = 0x00000104))))
  203. GROUP BY CASE WHEN (T1.SecondPeriod_ < {ts '4019-03-09 00:00:00'}) THEN 1.0 ELSE 2.0 END,
  204. T1.DayPeriod_,
  205. T1.SecondPeriod_,
  206. T1.RecorderTRef,
  207. T1.RecorderRRef,
  208. T1.Fld11126RRef,
  209. T1.Fld11129_TYPE,
  210. T1.Fld11129_RTRef,
  211. T1.Fld11129_RRRef,
  212. T1.Fld11128RRef,
  213. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CASE WHEN T27._IDRRef IS NOT NULL THEN 0x08 END ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN CASE WHEN T28._IDRRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN CASE WHEN T29._IDRRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN CASE WHEN T30._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN CASE WHEN T31._IDRRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN CASE WHEN T32._IDRRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN CASE WHEN T33._IDRRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN CASE WHEN T34._IDRRef IS NOT NULL THEN 0x08 END ELSE CAST(NULL AS BINARY(1)) END END,
  214. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CASE WHEN T27._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN CASE WHEN T28._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN CASE WHEN T29._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN T30._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN CASE WHEN T31._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN CASE WHEN T32._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN CASE WHEN T33._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN CASE WHEN T34._IDRRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END ELSE CAST(NULL AS DATETIME) END END,
  215. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CASE WHEN T27._IDRRef IS NOT NULL THEN 0x00000025 END ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN CASE WHEN T28._IDRRef IS NOT NULL THEN 0x000000D0 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN CASE WHEN T29._IDRRef IS NOT NULL THEN 0x000000CE END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN CASE WHEN T30._Date_Time IS NOT NULL THEN 0x00000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN CASE WHEN T31._IDRRef IS NOT NULL THEN 0x000000F1 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN CASE WHEN T32._IDRRef IS NOT NULL THEN 0x000000CD END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN CASE WHEN T33._IDRRef IS NOT NULL THEN 0x0000010C END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN CASE WHEN T34._IDRRef IS NOT NULL THEN 0x0000010A END ELSE CAST(NULL AS BINARY(4)) END END,
  216. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN T27._IDRRef ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN T28._IDRRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN T29._IDRRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN CASE WHEN T30._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN T31._IDRRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN T32._IDRRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN T33._IDRRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN T34._IDRRef ELSE CAST(NULL AS BINARY(16)) END END,
  217. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN T27._Description ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN T28._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN T29._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN T30._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN T31._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN T32._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN T33._Number WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN T34._Number ELSE CAST(NULL AS NVARCHAR(15)) END END,
  218. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CAST(NULL AS BINARY(1)) ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN CASE WHEN T28._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN CASE WHEN T29._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN CASE WHEN T30._Fld3883RRef IS NOT NULL THEN 0x08 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN CASE WHEN T31._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN CASE WHEN T32._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN CASE WHEN T33._Date_Time IS NOT NULL THEN 0x04 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN CASE WHEN T34._Date_Time IS NOT NULL THEN 0x04 END ELSE CAST(NULL AS BINARY(1)) END END,
  219. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CAST(NULL AS DATETIME) ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN T28._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN T29._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN CASE WHEN T30._Fld3883RRef IS NOT NULL THEN {ts '2001-01-01 00:00:00'} END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN T31._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN T32._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN T33._Date_Time WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN T34._Date_Time ELSE CAST(NULL AS DATETIME) END END,
  220. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN CAST(NULL AS BINARY(16)) ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN CASE WHEN T28._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN CASE WHEN T29._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN T30._Fld3883RRef WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN CASE WHEN T31._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN CASE WHEN T32._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN CASE WHEN T33._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN CASE WHEN T34._Date_Time IS NOT NULL THEN 0x00000000000000000000000000000000 END ELSE CAST(NULL AS BINARY(16)) END END,
  221. CASE WHEN (((((T1.Fld11130_TYPE = 0x01 AND T1.Fld11130_RTRef = 0x00000000 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) OR (T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C AND T1.Fld11130_RRRef = 0x00000000000000000000000000000000)) THEN 3.0 ELSE CASE WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D0 THEN 2.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CE THEN 1.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000D8 THEN 7.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000F1 THEN 5.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x000000CD THEN 0.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010C THEN 4.0 WHEN T1.Fld11130_TYPE = 0x08 AND T1.Fld11130_RTRef = 0x0000010A THEN 6.0 ELSE -1.0 END END,
  222. CASE WHEN T1.RecorderTRef = 0x00000112 THEN T8._Date_Time WHEN T1.RecorderTRef = 0x000000FD THEN T9._Date_Time WHEN T1.RecorderTRef = 0x000000D0 THEN T10._Date_Time WHEN T1.RecorderTRef = 0x000000CE THEN T11._Date_Time WHEN T1.RecorderTRef = 0x000000C8 THEN T12._Date_Time WHEN T1.RecorderTRef = 0x000000D9 THEN T13._Date_Time WHEN T1.RecorderTRef = 0x00000103 THEN T14._Date_Time WHEN T1.RecorderTRef = 0x000000D8 THEN T15._Date_Time WHEN T1.RecorderTRef = 0x000000D1 THEN T16._Date_Time WHEN T1.RecorderTRef = 0x000000F1 THEN T17._Date_Time WHEN T1.RecorderTRef = 0x00000104 THEN T18._Date_Time WHEN T1.RecorderTRef = 0x000000CD THEN T19._Date_Time WHEN T1.RecorderTRef = 0x000000CF THEN T20._Date_Time WHEN T1.RecorderTRef = 0x00000102 THEN T21._Date_Time WHEN T1.RecorderTRef = 0x000000D3 THEN T22._Date_Time WHEN T1.RecorderTRef = 0x0000010C THEN T23._Date_Time WHEN T1.RecorderTRef = 0x000000FF THEN T24._Date_Time WHEN T1.RecorderTRef = 0x000000D2 THEN T25._Date_Time WHEN T1.RecorderTRef = 0x0000010A THEN T26._Date_Time ELSE CAST(NULL AS DATETIME) END,
  223. SUBSTRING(CASE WHEN T1.RecorderTRef = 0x00000112 THEN T8._Fld6868 WHEN T1.RecorderTRef = 0x000000FD THEN T9._Fld5720 WHEN T1.RecorderTRef = 0x000000D0 THEN T10._Fld3298 WHEN T1.RecorderTRef = 0x000000CE THEN T11._Fld3226 WHEN T1.RecorderTRef = 0x000000C8 THEN T12._Fld2920 WHEN T1.RecorderTRef = 0x000000D9 THEN T13._Fld4033 WHEN T1.RecorderTRef = 0x00000103 THEN T14._Fld6138 WHEN T1.RecorderTRef = 0x000000D8 THEN T15._Fld3844 WHEN T1.RecorderTRef = 0x000000D1 THEN T16._Fld3326 WHEN T1.RecorderTRef = 0x000000F1 THEN T17._Fld5129 WHEN T1.RecorderTRef = 0x00000104 THEN T18._Fld6221 WHEN T1.RecorderTRef = 0x000000CD THEN T19._Fld3195 WHEN T1.RecorderTRef = 0x000000CF THEN T20._Fld3272 WHEN T1.RecorderTRef = 0x00000102 THEN T21._Fld6050 WHEN T1.RecorderTRef = 0x000000D3 THEN T22._Fld3437 WHEN T1.RecorderTRef = 0x0000010C THEN T23._Fld6577 WHEN T1.RecorderTRef = 0x000000FF THEN T24._Fld5854 WHEN T1.RecorderTRef = 0x000000D2 THEN T25._Fld3342 WHEN T1.RecorderTRef = 0x0000010A THEN T26._Fld6469 ELSE CAST(NULL AS NVARCHAR(MAX)) END, CAST(1.0 AS INT), CAST(100.0 AS INT)),
  224. T27._IDRRef,
  225. T27._Description,
  226. CASE WHEN (T1.SecondPeriod_ < {ts '4019-03-09 00:00:00'}) THEN N'Total overdue payments' ELSE N'Total scheduled payments' END,
  227. T1.Fld11131RRef,
  228. CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN 0x08 END ELSE 0x05 END,
  229. CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN N'' END ELSE N'' END,
  230. CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END ELSE 0x00000000000000000000000000000000 END,
  231. CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._Description WHEN T1.RecorderTRef = 0x000000D0 THEN T36._Description WHEN T1.RecorderTRef = 0x000000CE THEN T37._Description WHEN T1.RecorderTRef = 0x000000D9 THEN T38._Description WHEN T1.RecorderTRef = 0x00000103 THEN T39._Description WHEN T1.RecorderTRef = 0x000000D8 THEN T40._Description WHEN T1.RecorderTRef = 0x000000F1 THEN T41._Description WHEN T1.RecorderTRef = 0x000000CD THEN T42._Description WHEN T1.RecorderTRef = 0x000000CF THEN T43._Description WHEN T1.RecorderTRef = 0x00000102 THEN T44._Description WHEN T1.RecorderTRef = 0x000000D3 THEN T45._Description WHEN T1.RecorderTRef = 0x0000010C THEN T46._Description WHEN T1.RecorderTRef = 0x000000FF THEN T47._Description WHEN T1.RecorderTRef = 0x000000D2 THEN T48._Description WHEN T1.RecorderTRef = 0x0000010A THEN T49._Description ELSE CAST(NULL AS NVARCHAR(100)) END ELSE CAST(NULL AS NVARCHAR(100)) END,
  232. CASE WHEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN T35._IDRRef WHEN T1.RecorderTRef = 0x000000D0 THEN T36._IDRRef WHEN T1.RecorderTRef = 0x000000CE THEN T37._IDRRef WHEN T1.RecorderTRef = 0x000000D9 THEN T38._IDRRef WHEN T1.RecorderTRef = 0x00000103 THEN T39._IDRRef WHEN T1.RecorderTRef = 0x000000D8 THEN T40._IDRRef WHEN T1.RecorderTRef = 0x000000F1 THEN T41._IDRRef WHEN T1.RecorderTRef = 0x000000CD THEN T42._IDRRef WHEN T1.RecorderTRef = 0x000000CF THEN T43._IDRRef WHEN T1.RecorderTRef = 0x00000102 THEN T44._IDRRef WHEN T1.RecorderTRef = 0x000000D3 THEN T45._IDRRef WHEN T1.RecorderTRef = 0x0000010C THEN T46._IDRRef WHEN T1.RecorderTRef = 0x000000FF THEN T47._IDRRef WHEN T1.RecorderTRef = 0x000000D2 THEN T48._IDRRef WHEN T1.RecorderTRef = 0x0000010A THEN T49._IDRRef ELSE CAST(NULL AS BINARY(16)) END IS NOT NULL THEN CASE WHEN T1.RecorderTRef = 0x000000FD THEN 8.0 WHEN T1.RecorderTRef = 0x000000D0 THEN 8.0 WHEN T1.RecorderTRef = 0x000000CE THEN 8.0 WHEN T1.RecorderTRef = 0x000000D9 THEN 8.0 WHEN T1.RecorderTRef = 0x00000103 THEN 8.0 WHEN T1.RecorderTRef = 0x000000D8 THEN 8.0 WHEN T1.RecorderTRef = 0x000000F1 THEN 8.0 WHEN T1.RecorderTRef = 0x000000CD THEN 8.0 WHEN T1.RecorderTRef = 0x000000CF THEN 8.0 WHEN T1.RecorderTRef = 0x00000102 THEN 8.0 WHEN T1.RecorderTRef = 0x000000D3 THEN 8.0 WHEN T1.RecorderTRef = 0x0000010C THEN 8.0 WHEN T1.RecorderTRef = 0x000000FF THEN 8.0 WHEN T1.RecorderTRef = 0x000000D2 THEN 8.0 WHEN T1.RecorderTRef = 0x0000010A THEN 8.0 ELSE -1.0 END ELSE -1.0 END
  233. ORDER BY 1, 3, 4, 6, 7, 10, 11, 12
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement