Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6476543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:50:16+00:00 2026-05-25T06:50:16+00:00

From a simple SQL query in MySQL how can I get only the 5

  • 0

From a simple SQL query in MySQL how can I get only the 5 first results?
And then, how can I get the next 5 results?

For example (pseudo code):

select * from (select * from some_table) where <first 5 results>
select * from (select * from some_table) where <second 5 results (6-10)>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:50:17+00:00Added an answer on May 25, 2026 at 6:50 am

    You should be able to get the first 5 results with a LIMIT 5 at the end of your statement:

    SELECT * FROM some_table LIMIT 5;
    

    And then you can get results 6-10 with a query like this:

    SELECT * FROM some_table LIMIT 5 OFFSET 5;
    

    As another example, you could get results 6-15 with a query like this:

    SELECT * FROM some_table LIMIT 10 OFFSET 5;
    

    Please keep in mind that, if you don’t add an ORDER BY statement, the results are retrieved in arbitrary order. Consequently, it doesn’t really make sense to use LIMIT and OFFSET in the absence of an ORDER BY.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get my information from my SQL query (Name, Description, Latitude, Longitude) but I'm
I have this very simple sql statement: SELECT max_dose FROM psychotropes WHERE (patient_meds.psychotrope =
I have simple SSIS package where I import data from flat file into SQL
I am running some import code asynchronously from a simple WinForms app using a
Is there a one-line easy linq expression to just get everything from a simple
The CompareTo() method for my class is dynamic, and can range from a simple
I have got a MySql query that orders me results by no column (int,
I have a MySQL query like this: SELECT *, SUM(...some SQL removed for brevety)
We are migrating from an ASP.NET/SQL server setup to a rails/mysql setup. Because of
I'm an experienced MS SQL Server developer But with my first MySQL project I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.