Hi, I am working with a quite tricky SQL-Query that I would like to translate to LINQ.
Do you think it is possible?
WITH ConditionalChecks AS (
SELECT c.ItemId FROM ConditionalProperties c, Properties p
WHERE c.PropertyId = p.Id AND c.IsChecked = 1 AND (
(p.SystemName = 'eatable') OR
(p.SystemName = 'diy')
)
),
ConditionalCount AS (
SELECT ItemId, Count(*) AS NumTrue FROM ConditionalChecks
GROUP BY ItemId
),
ItemResult AS (
SELECT * FROM ConditionalCount c, Items i
WHERE c.ItemId = i.Id
)
SELECT * FROM ItemResult
WHERE NumTrue = 2
Any hints are appreciated!