Re: How to retrieve rows from position n to position m from table in Access 2003
- From: "'69 Camaro" <ForwardZERO_SPAM.To.69Camaro@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 31 Aug 2007 07:35:14 GMT
Hi, Orgil.
For example: I have a table "Notes". Which has 37 rows and I need to
get rows from 20th to 30th
I tried this:
SELECT TOP 30 * FROM Notes
WHERE [id] NOT IN
(SELECT TOP 20 [id] FROM Notes ORDER BY [id]) ORDER BY [id];
This will give you the next 30 rows after #20 (it stops at #37, because
that's the last row, so you only get 17 rows in this table, not 30), but you
only need the 10 rows (30th - 20th) between row #21 and #30, inclusive.
Change the TOP 30 to TOP 10. For example:
SELECT TOP 10 * FROM Notes
WHERE ID NOT IN
(SELECT TOP 20 ID FROM Notes ORDER BY ID) ORDER BY ID;
HTH.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
.
- Follow-Ups:
- References:
- Prev by Date: Re: Left Join and Where Statements
- Next by Date: Inner Join question!
- Previous by thread: How to retrieve rows from position n to position m from table in Access 2003
- Next by thread: Re: How to retrieve rows from position n to position m from table in Access 2003
- Index(es):
Relevant Pages
|