gpt4 book ai didi

mysql - MySQL group by 查询出错

转载 作者:行者123 更新时间:2023-11-29 23:01:53 25 4
gpt4 key购买 nike

我正在使用以下形式的 SQL 查询

   create table tb5
SELECT count(*) as count, question, responsesummary, questionid from tb4
where responsesummary!= rightanswer group by question,responsesummary

我得到的结果如下

        count                 question             responsesummary     id
5 q1 abc 331
6 q1 def 331
5 q1 abc 331

相反,我想要

       count                 question             responsesummary      id 
10 q1 abc 331
6 q1 def 331

我做错了什么?是否可以向现有结果添加新查询并获得所需的输出?

最佳答案

SELECT 
COUNT(*) as count,
question,
responsesummary,
question_id
FROM tb5
WHERE responsesummary!= rightanswer GROUP BY responsesummary,question_id,question

关于mysql - MySQL group by 查询出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28449351/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com