• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 799
  • Last Modified:

mysql one result

using mysql

select column from table order by column desc

I only want the fifth result
0
rgb192
Asked:
rgb192
  • 4
1 Solution
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
rgb192

Please explain why you've repeated this question, which you've accepted without responding to any other expert comments:

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_27831446.html
0
 
rgb192Author Commented:
I have to do a similar task with another database (mysql)
The first sql server result worked for me the best
0
 
rgb192Author Commented:
select column from table order by column desc limit 0,4
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
rgb192Author Commented:
does sql server also have limit function

because mysql does not have top or cte
0
 
hieloCommented:
what you have "... limit 0,4" will get you a total of four rows:
row 0, row 1, row 2, and row 3.  

NOTE: the first row is considered to be row 0, not row 1.

In other words, "...limit 0, 4" means, starting from row 0, give me a total of 4 rows.

If all you want is ONE row (the fifth row), then what you need is "... LIMIT 4, 1", which reads "starting on row 4 (which is actually the fifth row), give me just one row"

Reference on LIMIT:
http://dev.mysql.com/doc/refman/5.0/en/select.html#id757385
0
 
rgb192Author Commented:
Well explained
thank you
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now