阅读:8689回复:2
求Sql算平均分,不用子查询的方法。
select *,score/num
from ( select (SELECT sum(Evaluation_Source) from user_evaluation WHERE Resource_Id=b.dataid) score, (SELECT count(Resource_Id) from user_evaluation WHERE Resource_Id=b.dataid) num, b.dataid as id, b.filename, b.dataoffdepname, b.datasummary, b.downloads, b.creation_date, b.created_user_name from user_collection a, in_datadetail b where a.Resource_Id = b.dataid ) d |
|
板凳#
发布于:2016-04-08 11:39
|
|