Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
DECLARE @__filter_FactoryName_0 nvarchar(4000) = N'Bayer AG'; DECLARE @__p_1 int = 0; DECLARE @__p_2 int = 10; SELECT [c].[Id], [c].[AggregationToCartonReportTaskId], [c].[AggregationToPalletReportTaskId], [c].[DesadvTransactionDate], [c].[DesadvTransactionId], [c].[PoTransactionDate], [c].[PoTransactionId] FROM [ContractProductionShippings] AS [c] WHERE (@__filter_FactoryName_0 LIKE N'') OR (CHARINDEX(@__filter_FactoryName_0, ( SELECT TOP(1) [f].[Name] FROM [LabelCodes] AS [l] INNER JOIN [ItemCodes] AS [i] ON [l].[ItemCode] = [i].[Code] LEFT JOIN [Factories] AS [f] ON [i].[FactoryId] = [f].[Id] WHERE (( SELECT TOP(1) [c0].[Id] FROM [ContractProductionBatches] AS [c0] WHERE [c].[Id] = [c0].[ContractProductionShippingId]) IS NOT NULL) AND ((( SELECT TOP(1) [c1].[Id] FROM [ContractProductionBatches] AS [c1] WHERE [c].[Id] = [c1].[ContractProductionShippingId]) = [l].[ContractProductionBatchId]) OR ((( SELECT TOP(1) [c1].[Id] FROM [ContractProductionBatches] AS [c1] WHERE [c].[Id] = [c1].[ContractProductionShippingId]) IS NULL) AND ([l].[ContractProductionBatchId] IS NULL))))) > 0) ORDER BY [c].[Id] DESC OFFSET @__p_1 ROWS FETCH NEXT @__p_2 ROWS ONLY; |--Top(OFFSET EXPRESSION:(CONVERT_IMPLICIT(bigint,[@__p_1],0)),TOP EXPRESSION:(CONVERT_IMPLICIT(bigint,[@__p_2],0))) |--Nested Loops(Left Semi Join, OUTER REFERENCES:([c].[Id])) |--Clustered Index Scan(OBJECT:([StadaIntegrationService].[dbo].[ContractProductionShippings].[PK_ContractProductionShippings] AS [c]), ORDERED BACKWARD) |--Concatenation |--Filter(WHERE:(STARTUP EXPR([@__filter_FactoryName_0] like N''))) | |--Constant Scan |--Filter(WHERE:(charindex([@__filter_FactoryName_0],[StadaIntegrationService].[dbo].[Factories].[Name] as [f].[Name])>(0))) |--Nested Loops(Left Outer Join) |--Constant Scan |--Top(TOP EXPRESSION:((1))) |--Nested Loops(Left Outer Join, WHERE:([StadaIntegrationService].[dbo].[ItemCodes].[FactoryId] as [i].[FactoryId]=[StadaIntegrationService].[dbo].[Factories].[Id] as [f].[Id])) |--Nested Loops(Inner Join, OUTER REFERENCES:([l].[ItemCode])) | |--Nested Loops(Inner Join) | | |--Top(TOP EXPRESSION:((1))) | | | |--Index Seek(OBJECT:([StadaIntegrationService].[dbo].[ContractProductionBatches].[IX_ContractProductionBatches_ContractProductionShippingId] AS [c0]), SEEK:([c0].[ContractProductionShippingId]=[StadaIntegrationService].[dbo].[ContractProductionShippings].[Id] as [c].[Id]) ORDERED FORWARD) | | |--Nested Loops(Left Semi Join, OUTER REFERENCES:([l].[ContractProductionBatchId])) | | |--Clustered Index Scan(OBJECT:([StadaIntegrationService].[dbo].[LabelCodes].[PK_LabelCodes] AS [l])) | | |--Concatenation | | |--Filter(WHERE:([StadaIntegrationService].[dbo].[ContractProductionBatches].[Id] as [c1].[Id]=[StadaIntegrationService].[dbo].[LabelCodes].[ContractProductionBatchId] as [l].[ContractProductionBatchId])) | | | |--Top(TOP EXPRESSION:((1))) | | | |--Index Seek(OBJECT:([StadaIntegrationService].[dbo].[ContractProductionBatches].[IX_ContractProductionBatches_ContractProductionShippingId] AS [c1]), SEEK:([c1].[ContractProductionShippingId]=[StadaIntegrationService].[dbo].[ContractProductionShippings].[Id] as [c].[Id]) ORDERED FORWARD) | | |--Filter(WHERE:([StadaIntegrationService].[dbo].[ContractProductionBatches].[Id] as [c1].[Id] IS NULL)) | | |--Nested Loops(Left Outer Join) | | |--Filter(WHERE:(STARTUP EXPR([StadaIntegrationService].[dbo].[LabelCodes].[ContractProductionBatchId] as [l].[ContractProductionBatchId] IS NULL))) | | | |--Constant Scan | | |--Top(TOP EXPRESSION:((1))) | | |--Index Seek(OBJECT:([StadaIntegrationService].[dbo].[ContractProductionBatches].[IX_ContractProductionBatches_ContractProductionShippingId] AS [c1]), SEEK:([c1].[ContractProductionShippingId]=[StadaIntegrationService].[dbo].[ContractProductionShippings].[Id] as [c].[Id]) ORDERED FORWARD) | |--Clustered Index Seek(OBJECT:([StadaIntegrationService].[dbo].[ItemCodes].[PK_ItemCodes] AS [i]), SEEK:([i].[Code]=[StadaIntegrationService].[dbo].[LabelCodes].[ItemCode] as [l].[ItemCode]) ORDERED FORWARD) |--Clustered Index Scan(OBJECT:([StadaIntegrationService].[dbo].[Factories].[PK_Factories] AS [f]))

Stuck with a problem? Got Error? Ask AI support!

Copy Clear