我有一张表格,记录了我们公司客户名单上发生的所有事情。这是它的样子:
Company CompanyType Change_Dt Chng_Type
Apple Large 12/12/2012 A
Dell Large 12/01/2012 A
Adobe Mid 06/12/2012 A
Dell Large 11/01/2012 D
eBay Small 11/02/2012 A
Apple Large 10/29/2012 D
Dell Large 10/20/2012 A
eBay Small 10/02/2012 D
3M Small 09/02/2012 D
Adobe Mid 05/30/2012 D
问题是有很多 CompanyTypes,我只想保留一份最新的“A”活动公司的列表。最后,我应该有 1 个如下所示的列表:
CompanyType Company Change_Dt Chng_Type
Large Apple 12/12/2012 A
Large Dell 12/01/2012 A
Mid Adobe 06/12/2012 A
Small eBay 11/02/2012 A
到目前为止,我的查询是:
table.OrderBy(t => CompanyType).Where(t => Chng_Type.Equals("A"))
如何完成查询?提前致谢。