oracle查询以显示最后的类似值行。。?
最后我需要显示表中类似的值行,而表中的其余行必须按升序排列 例如:oracle查询以显示最后的类似值行。。?,oracle,customization,Oracle,Customization,最后我需要显示表中类似的值行,而表中的其余行必须按升序排列 例如: Name salary --------------------- a 100 b 200 c 300 c 400 c 600 d 200 e 500 我需要输出为 Name salary ------------------
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
您可以使用下面的查询并相应地修改它
select name,salary,(select count(name) from table_name where name=a.name) count_nm from table_name a order by count_nm,salary;
希望这有帮助