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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:21:06+00:00 2026-06-03T14:21:06+00:00

I save user inputs (comments) in these tables. NEWS_COMMENTS – id – comment PRODUCT_COMMENTS

  • 0

I save user inputs (comments) in these tables.

NEWS_COMMENTS
- id
- comment

PRODUCT_COMMENTS
- id
- comment
- product_id

I wanted to add a history feature to my website. Like;

-Someone commented on XX news.
-Someone commented on YY product.
-Someone commented on ZZ product.

You noticed the issue. I don’t save timestamps or dates, so I can’t be sure which comment comes first. It can be either the news comment or product comment.

Does MySQL has a feature to select last 24 hour inputs? For example,

NEWS_COMMENTS has 3 new entries in last 24 hours.
PRODUCT_COMMENTS has 5 new entries in last 24 hours.

The query should select these 8 entries ordering by their entry date/timestamp.

Can I do this without altering my current pages? Can you provide a query?

  • 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-03T14:21:07+00:00Added an answer on June 3, 2026 at 2:21 pm

    All you need to do is add a column with type timestamp and the option DEFAULT CURRENT_TIMESTAMP. You probably don’t need any other modifications to your code – MySQL will do the magic to ensure that the timestamp is automatically filled in when you insert rows.

    • Automatic Initialization and Updating for TIMESTAMP and DATETIME

    Then you can get the rows from the last 24 hours with a simple query:

    SELECT col1, col2, ..., coln
    FROM yourtable
    WHERE yourtimestampcol > NOW() - interval 24 hour
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a textfield that the user inputs, then I save it with NSKeyedArchiver
I am trying to save a user comment to my ashx web handler using
I need to use AJAX to save user input comments instantly to the database.
In my app, the user can save his input to disk. This is done
I am working on a project and I need to save user configuration. The
I'm having hard time trying to figure out how to auto-save user data in
I am using Android 2.1 sdk and I am trying to save user loggin
i want to save the user's profile picture of facebook to my disk, it
What is the best way to save a user profile with Google App Engine
I am working on a project and I want to save the user log

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.