SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
INSERT INTO #tt1511 WITH(TABLOCK) (_Q_000_F_000_TYPE, _Q_000_F_000_RTRef, _Q_000_F_000_RRRef, _Q_000_F_001RRef, _Q_000_F_002, _Q_000_F_003, _Q_000_F_004) SELECT DISTINCT T1.Q_001_F_001_TYPE, T1.Q_001_F_001_RTRef, T1.Q_001_F_001_RRRef, T1.Q_001_F_003RRef, T1.Q_001_F_002_, @P1, 0x00 FROM (SELECT T2._Q_001_F_000 AS Q_001_F_000_, T2._Q_001_F_001_TYPE AS Q_001_F_001_TYPE, T2._Q_001_F_001_RTRef AS Q_001_F_001_RTRef, T2._Q_001_F_001_RRRef AS Q_001_F_001_RRRef, T4._Q_000_F_007 AS Q_001_F_002_, T4._Q_000_F_002RRef AS Q_001_F_003RRef, T4._Q_000_F_000_TYPE AS Q_001_F_004_TYPE, T4._Q_000_F_000_RTRef AS Q_001_F_004_RTRef, T4._Q_000_F_000_RRRef AS Q_001_F_004_RRRef, T4._Q_000_F_001_TYPE AS Q_001_F_005_TYPE, T4._Q_000_F_001_RRRef AS Q_001_F_005_RRRef, T4._Q_000_F_003_TYPE AS Q_001_F_006_TYPE, T4._Q_000_F_003_RRRef AS Q_001_F_006_RRRef, T4._Q_000_F_004RRef AS Q_001_F_007RRef, T4._Q_000_F_005RRef AS Q_001_F_008RRef, T4._Q_000_F_006 AS Q_001_F_009_, T4._Q_000_F_008_TYPE AS Q_001_F_010_TYPE, T4._Q_000_F_008_RTRef AS Q_001_F_010_RTRef, T4._Q_000_F_008_RRRef AS Q_001_F_010_RRRef, T4._Q_000_F_009_TYPE AS Q_001_F_011_TYPE, T4._Q_000_F_009_RRRef AS Q_001_F_011_RRRef, T4._Q_000_F_010_TYPE AS Q_001_F_012_TYPE, T4._Q_000_F_010_RRRef AS Q_001_F_012_RRRef, T4._Q_000_F_011_TYPE AS Q_001_F_013_TYPE, T4._Q_000_F_011_RRRef AS Q_001_F_013_RRRef, CAST(((CAST(T4._Q_000_F_013 AS NUMERIC(31, 10))) * T2._Q_001_F_011) AS NUMERIC(31, 2)) AS Q_001_F_014_, CAST(((CAST(T4._Q_000_F_014 AS NUMERIC(31, 10))) * T2._Q_001_F_011) AS NUMERIC(31, 2)) AS Q_001_F_015_, CAST(((CAST(T4._Q_000_F_015 AS NUMERIC(31, 10))) * T2._Q_001_F_011) AS NUMERIC(31, 2)) AS Q_001_F_016_, CAST(((CAST(T4._Q_000_F_016 AS NUMERIC(31, 10))) * T2._Q_001_F_011) AS NUMERIC(31, 2)) AS Q_001_F_017_, CAST(((CAST(T4._Q_000_F_017 AS NUMERIC(31, 10))) * T2._Q_001_F_011) AS NUMERIC(31, 2)) AS Q_001_F_018_, CAST(((CAST(T4._Q_000_F_018 AS NUMERIC(31, 10))) * T2._Q_001_F_011) AS NUMERIC(31, 2)) AS Q_001_F_019_ FROM #tt1248 T2 WITH(NOLOCK) LEFT OUTER JOIN dbo._Reference230 T3 ON (T2._Q_001_F_003_TYPE = 0x08 AND 0x000000E6 = 0x000000E6 AND T2._Q_001_F_003_RRRef = T3._IDRRef) AND (T3._Fld2111 = @P2) INNER JOIN #tt854 T4 WITH(NOLOCK) ON (0x08 = T2._Q_001_F_006_TYPE AND T4._Q_000_F_002RRef = T2._Q_001_F_006_RRRef) AND (T4._Q_000_F_000_TYPE = T2._Q_001_F_007_TYPE AND T4._Q_000_F_000_RTRef = T2._Q_001_F_007_RTRef AND T4._Q_000_F_000_RRRef = T2._Q_001_F_007_RRRef) AND (T4._Q_000_F_001_TYPE = T2._Q_001_F_008_TYPE AND T4._Q_000_F_001_RRRef = T2._Q_001_F_008_RRRef) AND (T4._Q_000_F_003_TYPE = T2._Q_001_F_005_TYPE AND T4._Q_000_F_003_RRRef = T2._Q_001_F_005_RRRef) AND (T4._Q_000_F_004RRef = (T3._Fld47979RRef)) AND (T4._Q_000_F_005RRef = (T3._Fld47980RRef)) WHERE (T2._Q_001_F_006_TYPE = 0x08 AND T2._Q_001_F_006_RRRef IN (@P3, @P4, @P5, @P6)) AND (NOT (((T4._Q_000_F_012RRef IN (@P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, @P15, @P16, @P17))))) AND (T2._Q_001_F_011 <> @P18) UNION ALL SELECT CASE WHEN (T6._RecordKind = @P19) THEN 0x01 ELSE 0x00 END, CASE WHEN T6._RecorderTRef IS NULL THEN 0x01 ELSE 0x08 END, ISNULL(T6._RecorderTRef,0x00000000), ISNULL(T6._RecorderRRef,0x00000000000000000000000000000000), T5._Fld99741 AS Fld99741_, T5._Fld99736RRef AS Fld99736RRef, T5._Fld99734_TYPE AS Fld99734_TYPE, T5._Fld99734_RTRef AS Fld99734_RTRef, T5._Fld99734_RRRef AS Fld99734_RRRef, 0x08 AS Fld99735_TYPE, T5._Fld99735RRef AS Fld99735_RRRef, 0x08 AS Fld99737_TYPE, T5._Fld99737RRef AS Fld99737_RRRef, T5._Fld99738RRef AS Fld99738RRef, T5._Fld99739RRef AS Fld99739RRef, T5._Fld99740 AS Fld99740_, T5._Fld99742_TYPE AS Fld99742_TYPE, T5._Fld99742_RTRef AS Fld99742_RTRef, T5._Fld99742_RRRef AS Fld99742_RRRef, 0x08 AS Fld99743_TYPE, T5._Fld99743RRef AS Fld99743_RRRef, 0x08 AS Fld99744_TYPE, T5._Fld99744RRef AS Fld99744_RRRef, 0x08 AS Fld99745_TYPE, T5._Fld99745RRef AS Fld99745_RRRef, -(CAST(((T5._Fld99747) * ISNULL(T6._Fld42575,@P20)) AS NUMERIC(31, 2))), -(CAST(((T5._Fld99748) * ISNULL(T6._Fld42575,@P21)) AS NUMERIC(31, 2))), -(CAST(((T5._Fld99749) * ISNULL(T6._Fld42575,@P22)) AS NUMERIC(31, 2))), -(CAST(((T5._Fld99750) * ISNULL(T6._Fld42575,@P23)) AS NUMERIC(31, 2))), -(CAST(((T5._Fld99751) * ISNULL(T6._Fld42575,@P24)) AS NUMERIC(31, 2))), -(CAST(((T5._Fld99752) * ISNULL(T6._Fld42575,@P25)) AS NUMERIC(31, 2))) FROM dbo._InfoRg99733 T5 LEFT OUTER JOIN dbo._AccumRg42566 T6 LEFT OUTER JOIN dbo._Reference230 T7 ON (T6._Fld42567RRef = T7._IDRRef) AND (T7._Fld2111 = @P26) ON ((T5._Fld99736RRef = T6._Fld42570RRef) AND (T5._Fld99734_TYPE = T6._Fld42571_TYPE AND T5._Fld99734_RTRef = T6._Fld42571_RTRef AND T5._Fld99734_RRRef = T6._Fld42571_RRRef) AND (T5._Fld99735RRef = T6._Fld42572RRef) AND (T5._Fld99737RRef = T6._Fld42569RRef) AND (T5._Fld99738RRef = T7._Fld47979RRef) AND (T5._Fld99739RRef = T7._Fld47980RRef) AND ((T6._Period >= @P27) AND (T6._Period <= @P28)) AND (T6._Fld42570RRef IN (@P29, @P30, @P31, @P32)) AND (T6._Fld42575 <> @P33)) AND (T6._Fld2111 = @P34) WHERE ((T5._Fld2111 = @P35)) AND ((T5._Fld99741 >= @P36) AND (T5._Fld99741 <= @P37) AND (T5._Fld99736RRef IN (@P38, @P39, @P40, @P41)) AND (NOT (((T5._Fld99746RRef IN (@P42, @P43, @P44, @P45, @P46, @P47, @P48, @P49, @P50, @P51, @P52))))))) T1 GROUP BY T1.Q_001_F_000_, T1.Q_001_F_002_, T1.Q_001_F_001_TYPE, T1.Q_001_F_001_RTRef, T1.Q_001_F_001_RRRef, T1.Q_001_F_003RRef, T1.Q_001_F_004_TYPE, T1.Q_001_F_004_RTRef, T1.Q_001_F_004_RRRef, T1.Q_001_F_005_TYPE, T1.Q_001_F_005_RRRef, T1.Q_001_F_006_TYPE, T1.Q_001_F_006_RRRef, T1.Q_001_F_007RRef, T1.Q_001_F_008RRef, T1.Q_001_F_009_, T1.Q_001_F_012_TYPE, T1.Q_001_F_012_RRRef, T1.Q_001_F_013_TYPE, T1.Q_001_F_013_RRRef, T1.Q_001_F_010_TYPE, T1.Q_001_F_010_RTRef, T1.Q_001_F_010_RRRef, T1.Q_001_F_011_TYPE, T1.Q_001_F_011_RRRef HAVING (CAST(SUM(T1.Q_001_F_014_) AS NUMERIC(37, 2)) <> 0.0) OR (CAST(SUM(T1.Q_001_F_015_) AS NUMERIC(37, 2)) <> 0.0) OR (CAST(SUM(T1.Q_001_F_016_) AS NUMERIC(37, 2)) <> 0.0) OR (CAST(SUM(T1.Q_001_F_017_) AS NUMERIC(37, 2)) <> 0.0) OR (CAST(SUM(T1.Q_001_F_018_) AS NUMERIC(37, 2)) <> 0.0) OR (CAST(SUM(T1.Q_001_F_019_) AS NUMERIC(37, 2)) <> 0.0)

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear