mysql one result

Posted on 2012-08-16
Last Modified: 2012-08-16
using mysql

select column from table order by column desc

I only want the fifth result
Question by:rgb192
    LVL 65

    Expert Comment

    by:Jim Horn

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

    Author Comment

    I have to do a similar task with another database (mysql)
    The first sql server result worked for me the best

    Author Comment

    select column from table order by column desc limit 0,4

    Author Comment

    does sql server also have limit function

    because mysql does not have top or cte
    LVL 82

    Accepted Solution

    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:

    Author Closing Comment

    Well explained
    thank you

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now