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 |
Foxy
Starting Member
5 Posts |
Posted - 2010-11-15 : 07:10:41
|
Hi I need to write a top 10 query that selects the top 10 results for different processes in one query and I am really struggling can someone please help!!! |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-15 : 07:36:53
|
select top 10 ... from table order by somecolMadhivananFailing to plan is Planning to fail |
|
|
Foxy
Starting Member
5 Posts |
Posted - 2010-11-15 : 07:43:43
|
Select ProcessValuefromSelect top10 processValue where process = '1' oder by processValueselect top10 processValue where process = '2' order by processValuewhere...I need something like this |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-15 : 07:47:32
|
quote: Originally posted by Foxy Select ProcessValuefromSelect top10 processValue where process = '1' oder by processValueselect top10 processValue where process = '2' order by processValuewhere...I need something like this
Can you post the full code which is used?MadhivananFailing to plan is Planning to fail |
|
|
Foxy
Starting Member
5 Posts |
Posted - 2010-11-15 : 07:54:52
|
.. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-15 : 08:00:57
|
Ok. What is the problem with your query?MadhivananFailing to plan is Planning to fail |
|
|
Foxy
Starting Member
5 Posts |
Posted - 2010-11-15 : 08:10:28
|
.. |
|
|
michael.appleton
Posting Yak Master
160 Posts |
Posted - 2010-11-15 : 09:16:10
|
Use row_number to select top n from more than one group. Have a look here http://www.kodyaz.com/articles/top-n-random-rows-foreach-category-or-group.aspx |
|
|
Foxy
Starting Member
5 Posts |
|
|
|
|