with point as ( select info_id ,user_id ,timestampdiff(minute,visit_time,leave_time) tm from visit_tb ) select user_id ,floor(sum(tm)/10) point from point group by 1 having sum(tm)/10 >0 order by 2 desc