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
 General SQL Server Forums
 New to SQL Server Programming
 Help with SQL TOP command

Author  Topic 

misheck
Starting Member

1 Post

Posted - 2009-08-12 : 02:23:22
I need to retrieve row number 3 and 4 in database with 5 rows for an example I am working on. The TOP command examples I have been getting only give me an option for selecting from the top rows but never a given row like the LIMIT 2,2 in Mysql where I can select from where I want to start. Can anyone help with how I can modify the TOP statement to give me values from certain rows.

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-08-12 : 02:26:30
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/09/12/return-top-n-rows.aspx
refer to madhi solution ^^


Hope can help...but advise to wait pros with confirmation...
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-08-12 : 02:33:35
try this too

select top 2 * from
(select top 4 * from table_name order by column_no ) as tab order by column_no desc

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page
   

- Advertisement -