You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT
COALESCE(SUM([a].[FilesCount]), 0) AS [FilesCount],
COALESCE(SUM([a].[FilesEncryptedCount]), 0) AS [FilesEncryptedCount],
[c].[Caption],
[c].[CostUSD] AS [CostUsd],
[c].[Id],
CASE
WHEN
[c].[SensitiveType] =1
THEN
CAST(1ASbit)
ELSE
CAST(0ASbit)
END
AS [IsSensitive], [c].[Name], COALESCE(SUM([a1].[FilesCount]), 0) AS [FilesCount], COALESCE(SUM([a1].[FilesEncryptedCount]), 0) AS [FilesEncryptedCount], COALESCE(SUM([a1].[SensitiveFilesCount]), 0) AS [SensitiveFilesCount], [a0].[ProcessCaption], [a0].[WebApp], [a0].[Belongings], [d].[Id], [d].[Name],
CASE
WHEN
[t0].[ProcessType] IS NOT NULL
THEN
[t0].[ProcessType]
WHEN
[t].[ProcessType] IS NOT NULL
THEN
[t].[ProcessType]
ELSE
NULL
END
AS [ProcessType]
FROM
[ApplicationsControlMonitorEntriesAggregates] AS [a]
INNER JOIN
[ApplicationsControlAggregates] AS [a0]
ON [a].[ApplicationsControlAggregatesId] = [a0].[Id]
LEFT JOIN
(
SELECT
[p].[ProcessType],
[p].[ProcessName]
FROM
[ProcessStatisticRules] AS [p]
WHERE
[p].[TenantId] IS NULL
)
AS [t]
ON [a0].[ProcessCaption] = [t].[ProcessName]
LEFT JOIN
(
SELECT
[p0].[ProcessType],
[p0].[ProcessName]
FROM
[ProcessStatisticRules] AS [p0]
WHERE
[p0].[TenantId] = @___tenantId_3
)
AS [t0]
ON [a0].[ProcessCaption] = [t0].[ProcessName]
INNER JOIN
[Devices] AS [d]
ON [a0].[DeviceId] = [d].[Id]
INNER JOIN
[ContentFilters] AS [c]
ON [a].[FilterId] = [c].[Id]
INNER JOIN
[ApplicationsControlAggregates] AS [a1]
ON [a].[ApplicationsControlAggregatesId] = [a1].[Id]
WHERE
(
([a].[TenantId] = @___tenantId_0) AND
([a0].[ActionDate] >= @__request_StartPeriod_1)
)
AND
( [a0].[ActionDate] <= @__request_FinishPeriod_2 )
GROUP BY
[d].[Id],
[d].[Name],
[a0].[ProcessCaption],
[c].[Caption],
[c].[CostUSD],
[c].[Id],
CASE
WHEN
[c].[SensitiveType] =1
THEN
CAST(1ASbit)
ELSE
CAST(0ASbit)
END
, [c].[Name], [a0].[Belongings], [a0].[WebApp],
CASE
WHEN
[t0].[ProcessType] IS NOT NULL
THEN
[t0].[ProcessType]
WHEN
[t].[ProcessType] IS NOT NULL
THEN
[t].[ProcessType]
ELSE
NULL
END
Query almost fully corresponds to my expectation except double join of [ApplicationsControlAggregates] table.
leads to second join. Because exactly these fields in SQL query are taken from this joined table: COALESCE(SUM([a1].[FilesCount]), 0) AS [FilesCount], COALESCE(SUM([a1].[FilesEncryptedCount]), 0) AS [FilesEncryptedCount], COALESCE(SUM([a1].[SensitiveFilesCount]), 0) AS [SensitiveFilesCount]
Can I avoid this second join?
The text was updated successfully, but these errors were encountered:
Hi!
Microsoft.EntityFrameworkCore.SqlServer, 6.0.5
Here is my EF query:
It turns into the next SQL query:
Query almost fully corresponds to my expectation except double join of [ApplicationsControlAggregates] table.
It seems this part of EF query:
leads to second join. Because exactly these fields in SQL query are taken from this joined table:
COALESCE(SUM([a1].[FilesCount]), 0) AS [FilesCount], COALESCE(SUM([a1].[FilesEncryptedCount]), 0) AS [FilesEncryptedCount], COALESCE(SUM([a1].[SensitiveFilesCount]), 0) AS [SensitiveFilesCount]
Can I avoid this second join?
The text was updated successfully, but these errors were encountered: