Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Linq with Count and Group By

$
0
0

I'm porting legacy code that utilized stored procedures to Entity Framework Core.  The stored procedure looks like:

SELECT  Distinct DiagnosisCode, DiagnosisCodeDescription, Count(*) as Count from tbl_Log_PatientDiagnosisCodes Where DiagnosisCode <> '' And (DateofService > '01/01/2018' And DateofService < '06/30/2018') 
Group By DiagnosisCode, DiagnosisCodeDescription Order By Count Desc

I have two questions.  First, how do I convert this to a Linq query?  Second, what considerations should I look at as to whether to keep using stored procedures?  Any help would be appreciated.


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>