如何将此查询转换为实体到linq [英] how convert this query to entity to linq

查看:89
本文介绍了如何将此查询转换为实体到linq的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将此查询转换为实体为linq

how convert this query to entity to linq

select    COUNT(*)  AS DD ,FCourseName  from TCourse  GROUP  BY FCourseName HAVING COUNT(*) > 1

推荐答案

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 [ ^ ]


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[^]


<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);


这篇关于如何将此查询转换为实体到linq的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆