聚集函数是不是不能order by一起使用

如题所述

可以一起使用,不过进行order by的字段必须进行聚合运算或者出现在group by后
温馨提示:内容为网友见解,仅供参考
第1个回答  2012-08-16
可以一起使用的,比如
select name,max(id) from table group by name order by id
order by 一般都是放在最后面追问

后面是不是不能跟where了

追答

可以啊
Select Name,Max(Id) From user1 Where Name='d' Group By Name Order By max(Id)
当然where 还是放在from后面的

本回答被提问者采纳
相似回答