Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving N rows from a table.

Status
Not open for further replies.

sw9680

Technical User
Joined
Jan 17, 2010
Messages
1
Location
AU
Hi there!

I have a table which is structured like this:

Code:
| ROW_NUM |     DATE     |
| 1       | 01/01/1990   |
| 2       | 02/01/1990   |
| 3       | 03/01/1990   |
...
| 99      | 30/12/1999   |
|100      | 31/12/1999   |

(I.e. ROW_NUM is a hard coded column in the database).
If I run a SQL command which as such:

SELECT *
WHERE DATE = '30/12/1999'

How would I go about returning the date column of row 90 - 99? (I.e. I would want the resulting output to be the dates from 21/12/1999 to 30/12/1999).

Any help would be much much appreciated!
 
Try
Code:
select * from (select *, row_number() over (order by [Date]) as Row from myTable where [Date]<='19991230') X where Row between 90 and 99

PluralSight Learning Library
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top