首页 新闻 会员 周边 捐助

一张产品表,一张订单表,怎么样获得订单中最多的前10个产品的名称 ,订单表中只有产品ID,看下我写的LINQ:

0
[待解决问题]

  var linq = (from i in db.Integral_product_List
                        where (
                                  (from e in db.Exchange_Emp

                                   group e by e.productID  into g
                                   

                                    orderby g.Count() descending

                                   select g.Key).Contains(i.productID)
                                         
                              )

                        select i).Take(10).ToList();
订单表中在所有产品已经出来了,就是不它不按照订单表中产品在数量进行排序,
急,,急。。谢谢了个位。

以人会友的主页 以人会友 | 初学一级 | 园豆:8
提问于:2012-03-22 18:16
< >
分享
所有回答(1)
0
(from e in db.Exchange_Emp
join i in db.Integral_product_List    on e.productID == i.productID
group by e.productID into g
orderby g.Count() descending
select e).Take(10)

试试看这样

gunsmoke | 园豆:3592 (老鸟四级) | 2012-06-13 05:50
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册