March 11, 2010 at 2:25 am
Hi
Im trying to write query for:
my table has millions of rows ..
o/p should be only 50K rows ... and these rows should lie in any date range .
March 11, 2010 at 2:39 am
Do you mean some sort of pagination query kind of thing
SELECT TOP 100 * FROM (SELECT
ROW_NUMBER() OVER (ORDER BY Date) AS RowNumber,
*
FROM
dbo.Table) myResults
WHERE
RowNumber > 2
March 11, 2010 at 2:43 am
I would need to see min and max date for these 50rows.
More:
requirement is to have any date range that can give me 50k records (these records should lie in this date range 🙂 )
March 11, 2010 at 2:58 am
This works as i need
SELECT resultnr,timeinfo
FROM (SELECT ROW_NUMBER() OVER (ORDER BY timeinfo ASC) AS Row,
resultnr,timeinfo
FROM my_table) tmp
WHERE Row >1 and row <= 50
March 11, 2010 at 4:30 am
Post your table/index defintions
and also see link below my signature to get faster response on your posts/queries.
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply