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 9142097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:43:56+00:00 2026-06-17T09:43:56+00:00

I have a small chat app that I am working on, but got stuck

  • 0

I have a small chat app that I am working on, but got stuck with ordering and limiting the results that are displayed from the DB. I want to limit the results by 20 and display the latest results at the bottom of the HTML container DIV, I would need to get the highest ID of the chat table – 20 and then display those results. This is my current query

SELECT chat_box.*,

(SELECT MAX(chat_id) AS last FROM chat_box) AS last
FROM chat_box 
ORDER BY chat_id ASC
LIMIT last,20
  • 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-06-17T09:43:57+00:00Added an answer on June 17, 2026 at 9:43 am

    You don’t need a MAX if you just want to display the last 20 entries of the table.

    SELECT `you`, `should`, `use`, `a`, `column`, `list`
    FROM chat_box
    ORDER BY chat_id DESC
    LIMIT 20
    

    Update

    SELECT `you`, `should`, `use`, `a`, `column`, `list`
    FROM chat_box
    WHERE chat_id > (SELECT MAX(chat_id) - 20 FROM chat_box)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used to have a small chat app(which was almost working), that uses PHP,
I have written a small chat app that uses mysql + php to facilitate
I have a small application that I am building a Chat application into, so
I have written a small Node.js app, using connect , that serves up a
I'm working on some small chat application. I want to implement smilies over there
i have a script that allows me to port my in-game chat from Call
i have written small RMI chat program and its compiling properly.but when i try
I have small script that takes the value from a text input and needs
I have an app that connects to a remote chat server and then the
I have small test app: Socket socket = new Socket(jeck.ru, 80); PrintWriter pw =

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.