【发布时间】:2013-07-13 17:01:47
【问题描述】:
我想使用 linq 从数据库中选择不同的名字列
我的课是:
public partial class user
{
public string firstName{ get; set; }
public string lastName{ get; set; }
public int dgree{ get; set; }
public string class{ get; set; }
}
我使用以下代码但返回完整列表。
var query = (from user _db.Users
select user).Distinct().OrderBy(u=>u.firstName).ToList();
【问题讨论】:
-
在特定列上不同?