Saya merasa sulit untuk memahami mengapa Group Byis after the Selectclause di VB.
Arvin
-2
Solusi di bawah ini dapat membantu Anda.
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
selectnew
{
UnmanagedAssetRegistryID = grouped.Key,
Count = grouped.Count()
};
Jawaban:
Seperti ini:
from c in db.Company group c by c.Name into grp where grp.Count() > 1 select grp.Key
Atau, menggunakan sintaks metode:
Company .GroupBy(c => c.Name) .Where(grp => grp.Count() > 1) .Select(grp => grp.Key);
sumber
Untuk siapa pun yang ingin melakukan ini di vb (seperti saya dan tidak dapat menemukan apa pun)
From c In db.Company Select c.Name Group By Name Into Group Where Group.Count > 1
sumber
Group By
is after theSelect
clause di VB.Solusi di bawah ini dapat membantu Anda.
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() };
sumber