select * FROM (
SELECT @row_number := CASE WHEN @customer_no = user_id THEN @row_number + 1 ELSE 1 END AS num,
@customer_no := user_id AS user_id,
id,
update_time
FROM expert_course, (SELECT @row_number:=0, @customer_no:=0) AS temp
ORDER BY user_id DESC
) AS a
WHERE a.num <= 2
ORDER BY update_time;