このクエリをlinq(vb.net)で作成するにはどうすればよいですか?
select B.Name
from Company B
group by B.Name
having COUNT(1) > 1
このような:
from c in db.Company
group c by c.Name into grp
where grp.Count() > 1
select grp.Key
または、メソッド構文を使用します。
Company
.GroupBy(c => c.Name)
.Where(grp => grp.Count() > 1)
.Select(grp => grp.Key);
vbでこれを実行しようとしている人のために(私が何も見つけられなかったので)
From c In db.Company
Select c.Name Group By Name Into Group
Where Group.Count > 1
以下の解決策が役立つかもしれません。
var unmanagedDownloadcountwithfilter = from count in unmanagedDownloadCount.Where(d =>d.downloaddate >= startDate && d.downloaddate <= endDate)
group count by count.unmanagedassetregistryid into grouped
where grouped.Count() > request.Download
select new
{
UnmanagedAssetRegistryID = grouped.Key,
Count = grouped.Count()
};