【发布时间】:2015-02-16 14:44:40
【问题描述】:
我有以下 2 个表:
Account
----------
account_id **PK**
account_name
account_type_id **FK**
Account_Type
-------------
account_type_id **PK (FK in account table)**
account_type_name
account_type_reference
使用实体框架我试图得到这样的结果:
DbSet.Where(Account => Account.Account_Type.account_type_name == 'type1').ToList());
这可行,但是我不确定如何将 group by 添加到此语句中。我想按 Account_Type_id、Account_type_name、Account_type_reference 对这些进行分组,这样我就不会得到重复的行。我该怎么做?
谢谢
【问题讨论】:
-
按
account_type_id分组就足够了,因为它是独一无二的(我希望如此)。
标签: c# linq linq-to-entities entity-framework-6