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 |
|
gobotsoup
Starting Member
6 Posts |
Posted - 2007-07-20 : 13:27:31
|
| hello here is my problem:I need to first order a bunch of rows by date, then select the top ten of those rows. SOrry this should be easy, but I am pretty new at this. |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-07-20 : 13:31:02
|
| (1) Questions like these have to include some sample data and expected output. (2) similar question has been answered. Check out the sticky post in the "New to SQL Server" section.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
rudesyle
Posting Yak Master
110 Posts |
Posted - 2007-07-20 : 13:32:29
|
| select top 10 recsfrom tableorder by date |
 |
|
|
gobotsoup
Starting Member
6 Posts |
Posted - 2007-07-20 : 13:37:49
|
quote: Originally posted by rudesyle select top 10 recsfrom tableorder by date
Doesn't the order by happen after the selection is made? I need all of the dates in the table ordered by date and then get the top ten. dinakar: I couldnt find the article you are talking about. |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-07-20 : 13:40:53
|
| http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-07-20 : 14:11:15
|
order happens first, then the top N rows are cut off, so rudesyle's code is what you want. elsasoft.org |
 |
|
|
gobotsoup
Starting Member
6 Posts |
Posted - 2007-07-20 : 14:22:05
|
| Thanks a lot! |
 |
|
|
|
|
|