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.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Help me in getting top 10 records

Author  Topic 

kadiyalabindu
Starting Member

7 Posts

Posted - 2005-09-19 : 02:23:05
Hi All,

I want an SQL query - select top 10 records except for the top 10 records.

select top 10 records from tablename;

Its not working.

Can anyone solve this problem.

Thanks in Advance

Kristen
Test

22859 Posts

Posted - 2005-09-19 : 02:27:50
"select top 10 records except for the top 10 records"

Do you mean you want records 11-20 ?

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-19 : 02:29:36
>>select top 10 records from tablename;
Its not working.

Post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-09-19 : 04:55:03
hmm... i think this is a paradox

did you mean select next 10 records after the first 10 records like what Kristen asked?


you need to post more information if you want your question answered

quote:
Originally posted by kadiyalabindu

Hi All,

I want an SQL query - select top 10 records except for the top 10 records.

select top 10 records from tablename;

Its not working.

Can anyone solve this problem.

Thanks in Advance



--------------------
keeping it simple...
Go to Top of Page

supersql
Yak Posting Veteran

99 Posts

Posted - 2005-09-19 : 09:23:29
Bindu
I understand that u need records from 11-20 as kristen said.Can u post ur query and the error u r getting.
Go to Top of Page

WYSIWYG
Starting Member

15 Posts

Posted - 2005-09-19 : 16:40:36
Here is an example from the Northwind Database using the Orders table:

-- first 10 orders
select top 10 *
from
orders
order by
orderid

-- next 10 orders
select top 10 *
from orders
where orderid not in (select top 10 orderid from orders order by orderid)
order by orderid

NOTE: There may be a better solution, but this will exclude the top ten results.
Go to Top of Page
   

- Advertisement -