[英]How can I get just one field from a database table with SQLite?
I have this class:我有这个 class:
public class CarConfiguration : ObservableObject
{
[PrimaryKey, NotNull]
public long CarConfigurationId { get; set; }
public string Name { get; set; }
}
With this code I know I can get all the rows:使用此代码,我知道我可以获得所有行:
public List<CarConfiguration> GetUniqueCarConfigurationNames()
{
return db2.Table<CarConfiguration>().ToList();
}
But how can I get all the unique names only sorted by name?但是我怎样才能得到所有唯一按名称排序的名称呢?
use a Query使用查询
return db2.Query<string>("select distinct Name from CarConfiguration order by Name").ToList();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.