LLblgen:选择与众不同? [英] LLblgen: Select distinct?
问题描述
我似乎无法弄清楚如何在Llblgen 2.6自助服务模型中仅选择不同的条目
I can't seem to figure out how I can select only distinct entries in Llblgen 2.6 self-service model
我本质上想要这个查询.
I essentially want this query.
select distinct City
from peopleTable
where *predicates*
我有我的PeopleCollection,我不确定是否有可以调用的独特方法或可以传递给GetMulti()的参数.
I've got my PeopleCollection and I'm not sure if there's a distinct method I can call or argument I can pass to GetMulti().
推荐答案
实体在定义上是不能区分的-即使它们具有相同的值,它们也是同一表中的不同行.
Entities by definition cannot be distinct - even if they have the same value they are different rows in the same table.
您可以使用TypedList或DynamicList获得城市值的唯一列表-Fetch调用中的参数之一就是获得不同的项目.
You could use a TypedList or DynamicList to get a distinct list of city values - one of the parameters on the Fetch call is to get distinct items.
或者,如果您使用的是LINQ,则可以这样做
Or if you are using LINQ you could do
List<string> cities = PeopleCollection.Select(x=>x.City).Distinct();
这篇关于LLblgen:选择与众不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!