Created
March 1, 2015 09:33
-
-
Save veapon/15175446c8edc7c06cd0 to your computer and use it in GitHub Desktop.
按分组取最大
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#按name分组取最大的两个(N个)val | |
select a.* from tb a where 2 > (select count(*) from tb where name = a.name and val > a.val ) order by a.name,a.val |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment