All pastes #358906 Raw Edit

Mine

public sql v1 · immutable
·published 2007-02-16 13:35 UTC
rendered paste body
SELECT questions.id AS question_id, questions.title AS question_title, options.description AS option_desc, options.id AS option_id, count( answers.id ) AS answers_countFROM questionsINNER JOIN options ON options.question = questions.idINNER JOIN answers ON answers.option_id = options.idWHERE (options.type = 'radio')AND questions.inquiry =39AND answers.response NOT IN (SELECT answers.response FROM answers WHERE answers.inquiry = 39 AND answers.option_id IN ( 485 ))GROUP BY options.idORDER BY question_id, answers_count DESC