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.
Author |
Topic |
tejokrishna
Starting Member
6 Posts |
Posted - 2014-02-11 : 15:28:46
|
Hi,Pls tell me ans for below questions:1. How to select second row of particular table?2. How to select alternate records of particular table?Y.Tejo Krishna |
|
shilpash
Posting Yak Master
103 Posts |
Posted - 2014-02-11 : 17:42:34
|
1)lets say id is ur primary key) SELECT TOP 1 * FROM tablename WHERE id NOT IN ( SELECT TOP 1 * FROM tablename )2)alternate rows---SELECT *FROM ( SELECT id , RANK() OVER ( ORDER BY id ) rn FROM tablename ) tWHERE ( t.rn % 2 = 0 ) |
|
|
|
|
|