My AC solution

  • 5
    SELECT question_id as survey_log
    	SELECT question_id, SUM(case when action="show" THEN 1 ELSE 0 END) as num_show,    SUM(case when action="answer" THEN 1 ELSE 0 END) as num_answer
    	FROM survey_log
    	GROUP BY question_id
    ) as tbl
    ORDER BY (num_answer / num_show) DESC LIMIT 1

  • 0

    @kexiao1612 How to deal, there is two or more same max rate, limit 1 can not have multi question_id

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.