有关将我的下面的SQL转换为linq查询的任何帮助吗?
SELECT *
FROM BaseCategory
WHERE
Id = (SELECT ParentId FROM BaseCategory WHERE Id = 10)
UNION ALL
SELECT *
FROM BaseCategory
WHERE
ParentId = (SELECT ParentId FROM BaseCategory WHERE Id = 10)
答案 0 :(得分:0)
你走了:
var query = (from c in db.BaseCategory
where c.Id = (From c1 in db.BaseCategory
where c1.Id == 10 select c1.ParentId)
select c)
.Concat
(from c in db.BaseCategory
where c.ParentId = (From c1 in db.BaseCategory
where c1.Id == 10 select c1.ParentId)
select c)