SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Help me in getting top 10 records
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

kadiyalabindu
Starting Member

7 Posts

Posted - 09/19/2005 :  02:23:05  Show Profile
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

United Kingdom
22415 Posts

Posted - 09/19/2005 :  02:27:50  Show Profile
"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

India
22761 Posts

Posted - 09/19/2005 :  02:29:36  Show Profile  Send madhivanan a Yahoo! Message
>>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
Flowing Fount of Yak Knowledge

Sweden
4110 Posts

Posted - 09/19/2005 :  04:55:03  Show Profile  Send jen a Yahoo! Message
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 - 09/19/2005 :  09:23:29  Show Profile
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

USA
15 Posts

Posted - 09/19/2005 :  16:40:36  Show Profile
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
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000