MySQL GROUP BY不工作

时间:2014-10-15 07:32:07

标签: mysql

我试图使用mysql计算软件名称的数量 这是我的原创,显示一切

 Select dico_soft.FORMATTED,dico_soft.EXTRACTED,softwares.NAME
 From dico_soft
 INNER JOIN softwares
 ON dico_soft.EXTRACTED=softwares.NAME;

我通过sql添加了count和Group的位置

 Select dico_soft.FORMATTED,dico_soft.EXTRACTED,softwares.NAME,count(*)
 From dico_soft
 INNER JOIN softwares
 ON dico_soft.EXTRACTED=softwares.NAME;
 Group BY = softwares.NAME;

结果只给了我一行,它添加了所有内容,这个小组没有工作

4 个答案:

答案 0 :(得分:1)

应该是

Group BY softwares.NAME;

而不是

Group BY = softwares.NAME;

答案 1 :(得分:0)

"=" SQL查询中删除GROUP BY

Select dico_soft.FORMATTED,dico_soft.EXTRACTED,softwares.NAME,count(*)
 From dico_soft
 INNER JOIN softwares
 ON dico_soft.EXTRACTED=softwares.NAME;
 Group BY softwares.NAME;

答案 2 :(得分:0)

我认为您需要执行以下查询

 Select softwares.NAME,count(softwares.NAME) as Quantity
  From dico_soft
  INNER JOIN softwares
  ON dico_soft.EXTRACTED=softwares.NAME;
  Group BY softwares.NAME;

这将获取软件名称和每个的数量

答案 3 :(得分:0)

您正在GROUP BY表上尝试设置JOIN。您需要按FROM表进行分组。也不需要= in GROUP BY

 Select dico_soft.FORMATTED, 
        dico_soft.EXTRACTED, 
        softwares.NAME,
        count(dico_soft.EXTRACTED)
 From dico_soft
 INNER JOIN softwares ON dico_soft.EXTRACTED = softwares.NAME;
 Group BY dico_soft.EXTRACTED;