------解决方案-------------------- select id,max(value) from aa group by id
------解决方案-------------------- select xihao,zhi,data from table where zhi=(select max(zhi) from table where group by xihao)
------解决方案-------------------- 就是横表纵向输出
SQL> select ord_id, max(sys_connect_by_path(opt, ' ')) s_opt 2 from (select ord_id, opt, lag(opt) over(partition by ord_id order by opt) l_opt 3 from t) 4 start with l_opt is null 5 connect by ord_id = prior ord_id and prior opt = l_opt 6 group by ord_id;
------解决方案-------------------- SELECT * FROM 表 WHERE 值=max(值) GROUP BY 序号
------解决方案--------------------
select 序号, max( 值) from 表名 group by 序号
就可以啦!
------解决方案--------------------
------解决方案-------------------- 如果有重复都列出的话如此
SQL code
select * from mytable where number in (select max(value) from mytable group by number)
------解决方案-------------------- 加distinct就可以了吧
------解决方案--------------------