如何使用大量ORM从表中检索不同的行。我需要从表'Student'获取具有列ID,StudentName,Age的唯一studentname列表。 ID是主键。
注意:使用Query()执行原始查询不是必需的。
答案 0 :(得分:2)
这个怎么样:
dynamic studentTable = new Students();
var students = studentTable.All(columns: "distinct StudentName");
答案 1 :(得分:0)
在studentname列上创建非聚集索引,然后尝试此查询
select distinct StudentName from Student