Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
oasis1
Starting Member
35 Posts |
Posted - 2012-10-02 : 17:01:54
|
is there a way to use Top to find the top 10 for example for each year rather than just returning the top 10 over all? mahalo, Brew |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-10-02 : 17:22:24
|
yep...but not using top. you can use below logicSELECTFROM(SELECT ROW_NUMBER() ORDER (PARTITION BY yearfield ORDER BY yoursortfield) AS seq,*FROM table)tWHERE seq<=10 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|