Straightforward SQL without subselects


  • 0
    C
    select question_id as survey_log from survey_log
    where answer_id is not null
    group by question_id
    order by count(question_id) desc
    limit 1
    

    Select the column question_id from table survey_log and call the result survey_log,
    for all rows which answer_id is not null
    group them by question_id
    and order by count(question_id) in descending order
    and only return the top 1 result.


  • 0

    @cockroachzl said in Straightforward SQL without subselects:

    select question_id as survey_log from survey_log
    where answer_id is not null
    group by question_id
    order by count(question_id) desc
    limit 1

    Actually it doesn't make sense because it's asking the RATE instead of answer number, there are some corner cases that the test cases haven't covered


Log in to reply
 

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