2014-11-25 30 views
0

我需要在最后显示的类似值的表行,而表的其余行具有进来升序...oracle查询最后显示相似的值行..?

为前:

Name   salary 
--------------------- 
a    100 
b    200 
c    300 
c    400 
c    600 
d    200 
e    500 

我需要的输出,

Name   salary 
----------------------- 
a    100 
b    200 
d    200 
e    500-----------------till here it has to come in ascending order ignoring 'c' 
c    300 
c    400 
c    600 

回答

1

您可以使用下面的查询,并相应修改

select name,salary,(select count(name) from table_name where name=a.name) count_nm from table_name a order by count_nm,salary; 

希望这会有所帮助!