Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我已经为此困扰了一段时间,似乎无法找到答案。
这是我的数据库图
我应该找到给出命令来显示每个问题分解的平均响应。我确信有一些非常简单的解决方案,但我必须过度思考或完全遗漏一些明显的东西。问题表中共有 6 个问题。
试试这样:
SELECT q.id, AVG(s.survey_response) FROM survey_questions q INNER JOIN survey_responses s ON q.id = s.survey_question_id GROUP BY q.id