plSQL语句出错,求助!!
select id,name, max(id) from table1
为啥执行不了呢?我想筛出某一属性值最大的一行的所有属性,该用什么语句呢?
[最优解释]
Oracle中的聚合函数如Count、Max、Min、Avg、Sum等在与其他元素一起进行查询操作时,需要对除聚合函数本身的元素进行分组,否则会报不是分组函数错误。
[其他解释]
select name, max(id) from table1 group by name
[其他解释]
select * from table1 where id = (select max(id) from table1);
[其他解释]
select * from table1 where id=( select max(id) from table1) ;