linq平均查询中的错误

linq平均查询中的错误

本文介绍了linq平均查询中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hello i have a linq query and i am going to findout average of rating in this query but its giving me error below is my query







fv1.DataSource = from st in obj.Book_details
                                
                               join f in obj.Rating_tables on st.Book_Id equals f.Book_id
                                 where st.Book_Id == book_id
                                 select new {  st.Book_Id, st.Book_index, st.Category, st.Edition,                 st.Authoers_Id ,f.Rating.Average()};
                fv1.DataBind();
















table book_detail--
book_id   book_namne    price
  1          ok          45
  2          pkl         56




now another table is 




rating_table
rating_id  book_id  rating
  1           1        4
  2           1        3
  3           2         5
   4          2        1
   5           1        3




now i want to find avg rating
where my linq query is 




var fgh  =  from st in obj.book_detail
            join t in obj.rating_table st.book_id equals t.book_id
            where st.book_id == bookid
            select new {st.book_name , st.book_id , st.price ,}




i am new in asp.net please help me in finding average rating

推荐答案



这篇关于linq平均查询中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 03:42