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 |
|
pamyral_279
Posting Yak Master
143 Posts |
Posted - 2007-03-25 : 03:54:03
|
| Hi everyone ,My structure and data of my table storeFirstname LastNameA1------------A11A2------------A22A3------------A33A4------------A44....I want to get each row by using "select top" statament.Example :select top 1 from mytable ==>I will get : A1 and A11My problem :How to get row which include : A2 and A22 by using "select top" !How to get row which include : A3 and A32 by using "select top" !and so on ...Any one show me solutions ?Thank you very much. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-25 : 04:25:54
|
You should always use TOP with ORDER BYselect top 1 * from mytable order by Firstname "How to get row which include : A3 and A32 by using "select top" !"You wanted to get the 3rd record ?select top 1 *from ( select top 3 * from mytable order by Firstname) aorder by Firstname desc KH |
 |
|
|
|
|
|