select col,max(...),min(...),sum(...),... from table group by col
group by 需要和聚集函数一起使用。

解决方案 »

  1.   

    order by (字段的集合)
    如:order field1 desc,field2 asc。
      

  2.   

    简单说
    select col1,sum(col2)... from table group by col1
    没有使用聚集函数的字段 例如col1必须在 group by 后
    col2 就不用了
      

  3.   

    我感觉错误最多的情况是从两个表中进行选择数据,然后以其中一个表的字段作为父查询group by的依据,而在子查询中,又要用到分类的情况,每次遇到多表查询group,我就傻眼了。