select id,name, max(id) from table1
为啥执行不了呢?我想筛出某一属性值最大的一行的所有属性,该用什么语句呢?

解决方案 »

  1.   

    select name, max(id) from table1 group by name
      

  2.   

    select * from table1 where id = (select max(id) from table1);
      

  3.   

    Oracle中的聚合函数如Count、Max、Min、Avg、Sum等在与其他元素一起进行查询操作时,需要对除聚合函数本身的元素进行分组,否则会报不是分组函数错误。
      

  4.   

    select * from table1 where id=( select max(id) from table1) ;