我想将此 EF 代码转换为 SQL 命令:
var parents = db.Fuels.Select(A => A.Parent).Distinct();
var data = db.Fuels.Where(B => !parents.Any(A => A == B.ID))
.OrderBy(A => A.Type);
我尝试编写SQL命令,但它不起作用:
select *
from Fuel as a
where id not in (select id from Fuel as b
where a.ID = b.Parent)
表结构:
ID INT PK,
Name NVARCHAR(50) Checked,
Parent INT FK
表数据
我想要这个输出
qq_笑_17
相关分类