我有以下要转换为Lambda表达式的SQL。
SELECT DISTINCT Make FROM
(
SELECT DISTINCT [Option] AS Make FROM [dbo].[ItemCategoryDetailOptions]
WHERE [IsHidden] = 0 AND [Retired] is null
UNION
SELECT DISTINCT [Brand] AS Make FROM [dbo].[Items] WHERE [Brand] is not null
) AS result
WHERE Make LIKE '%LG%'
答案 0 :(得分:1)
itemCategoryDetailOptions.Where(x => !x.IsHidden && x.Retired == null)
.Select(x => x.Option)
.Concat(items.Where(x => x.Brand != null)
.Select(x => x.Brand))
.Distinct()
.Where(x => x.Contains("LG"))
答案 1 :(得分:0)
var result = ItemCategoryDetailOptions
.Where(i => !i.IsHidden && i.Retired != null)
.Select(i => i.Option)
.Distinct()
.Union(Items
.Where(i => i.Brand != null)
.Select(i => i.Brand)
.Distinct()))
.Where(i => i.Contains("LG"));