-
Solve this Query
Hello friends,
I want to find only fifth row from a table please give me better solution.
thanks in adavance
regards
Harsh
-
Do you have any sequence column in the table?
-
Answer
Select Top 5 From Table_name
Order By Column_name Desc
-
Just don't
Relational Database Law (Or should be):
Never assume the order of the rows after insertion or retrival unless bound by an ordering clause.
And even with an ordering clause, you have to be extremely careful.
Select top 5 from table_name
If connecting through an app, burn through the first 4 results, and tada. If its a t-sql query, cursor through the result set and burn the first 4 lines.
but again, be careful. If you are ordering, moeedkreated's statement works.
-
run this query
select top 1 * from (select top 5 * from Table_Name order by Column_Name desc) Table_Name
This will give you the fifth row
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|