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

  • Home
  • SEARCH
  • 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 6550331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:12:11+00:00 2026-05-25T12:12:11+00:00

Let say I have a post table. But I want to query all today

  • 0

Let say I have a post table. But I want to query all today post. But if today post is less than 10 post, I will get back the yesterday post to query. If it is more than 10 posts, no need to query yesterday post….If SQL statement can’t do it. Is this only achieve it by calling the post manually….? Thank you.

***The database is MySQL

Let me clarify the question in a typical example:

If today have 5 posts….ONLY. And yesterday have 10 posts.

return : 5 today posts, and 5 posts from yesterday

If today have 12 posts....ONLY.
And yesterday have 10 posts. 

return : 12 today posts.

If today have 10 posts….ONLY. And yesterday have 10 posts.

return : 10 today posts.

If today have 2 posts....ONLY. yesterday have 5 posts, and the day before yesterday 5posts. 

return : 2 today posts, 5 yesterday posts, 3 the day before yesterday posts.
  • 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-25T12:12:11+00:00Added an answer on May 25, 2026 at 12:12 pm

    You can try

    select count(*) from post_table
    where date = todays_date
    

    and if the result is > 10 then

    select * from post_table
    where date = today's date
    

    else

    select * from post_table  
    order by date desc
    limit 10
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let say i have three table (post, wall, photo) post (id, post_uid, post_content, post_timestamp)
Let's say I have a Posts table and a Comments table. I want my
Let's say I have User model and Post model. Post model contains field user_id
Let's say I have some models: User , Post , and Vote . A
Let's say we have a service to add a new hotel: > POST /hotel
let say i have a page , and i want to allow 3rd party
Let's say I have a simple form, with a select combobox and a table
Let's say I have some data, either in a SQL Server 2008 table or
Let's say I have an edit view that is strongly-typed to a table called
Let's say that we have a users table, and a user can have many

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.