select *
from (
select userid,sum(comment_num)*2+sum(praise_num)+sum(browser_num)*0.2+sum(热图数)*3 as quanzhong
from tb
group by user_id
) D
order by quanzhong desc
limit 10;
------解决方案--------------------
SQL code
select user_id, sum(comment_num*2+praise_num+browser_num*0.2+热图数*3)
form pic
group by user_id
order by 2 desc
------解决方案--------------------
select userid,sum(comment_num)*2+sum(praise_num)+sum(browser_num)*0.2+sum(热图数)*3 as quanzhong from tb group by user_id order by 2 desc
------解决方案--------------------
SQL code
SELECT userid,SUM(comment_num)*2+SUM(praise_num)+SUM(browser_num)*0.2+SUM(热图数)*3 as quanzhong
FROM tb
GROUP BY user_id ORDER BY 2 DESC;
------解决方案-------------------- 热图数要另外统计的吧。。
------解决方案-------------------- select userid,sum(comment_num)*2+sum(praise_num)+sum(browser_num)*0.2+ sum(if(hot_status=3,1,0))*3 as quanzhong from tb group by user_id order by 2 desc
------解决方案--------------------