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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:18:20+00:00 2026-06-19T01:18:20+00:00

I have a content feed, ordered by date DESC, id DESC . date is

  • 0

I have a content feed, ordered by date DESC, id DESC.
date is just a date, not datetime.
id is a typical INT auto_increment.

I need to query for n rows that “come after a specific row”. (imagine an infinite scroll which requires to “fetch items that are older than the current last item”)

I would query for where id < :last_id, but the problem is that the order of date is not coherent with the one of _id.

I would query for where date < :last_date, but the problem is that there are more than 1 items “per day”. I would lose all items that use the same date.

I would query for ORDER BY date DESC, id DESC LIMIT x, n but the feed could change between the 2 queries, adding new items to the top, and therefore shifting the whole offset.

My current hacky solution is to query for where date <= :last_date ORDER BY LIMIT date DESC, id DESC LIMIT n+20 and then “manually” discarding the results that come before the current latest item. (hoping that there aren’t more than 20).

I’m sure I’m not the first one to encounter a similar problem… Any ideas?

  • 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-19T01:18:21+00:00Added an answer on June 19, 2026 at 1:18 am

    If you have more than one item per day, then you should already have a secondary sort order. If it’s id, then write your where clause like this:

    WHERE date < :last_date OR (date = :last_date AND id < :last_id)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an RSS feed, users will be using it to rip content to
I have an xml feed at this url Now im trying parse the content,
I have an RSS feed from Zendesk (http://mysupport.zendesk.com/forums/some-path/posts.rss) that I need to render as
I have the following JSON content that I'm pulling from a service feed: [
I have an rss feed that I am reading into. I need to retrieve
I have implementing feed parsing & get the content as a string. Now, I
I have this code: $(.feed-item .field-content p).each(function(i) { $(this).addClass(item + (i+1)); }); This code
I'm trying to put content from a JSON feed I have into an ListView,
I have content on my page in boxes. They are displayed like this. Box1
I have content loaded into a hidden iframe on a page and I'm wanting

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.