Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how convert this query to entity to linq
SQL
select    COUNT(*)  AS DD ,FCourseName  from TCourse  GROUP  BY FCourseName HAVING COUNT(*) > 1
Posted

I can't test here the query, so i'm unable to provide the exact expression for your query.i'm giving you some ref you can solve it yourself.<br />
and,it'll be better for you.

ref.
http://stackoverflow.com/questions/2078736/linq-with-group-by-having-count[^]
http://stackoverflow.com/questions/16489405/linq-query-with-group-by-and-count-into-anonymous-type[^]
http://stackoverflow.com/questions/13238087/linq-to-sql-nested-select-group-by-having-count[^]
 
Share this answer
 
<pre lang="c#">var result = context.TCourses.GroupBy(x => x.FCourseName).
            Where(x => x.Count() > 1).
            Select(x => new {name = x.Key, count = x.Count()}).
            OrderByDescending(x => x.count);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900