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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:45:48+00:00 2026-06-03T22:45:48+00:00

I need to create a field that will show the number of days between

  • 0

“I need to create a field that will show the number of days between a date and the present.

TABLE:  reg_add

+------------+---------+
| Name       | Type    |
+------------+---------+ 
| hm_date    | date    |
+------------+---------+ 
| total_days | date    |
+------------+---------+ 

My client will type in the following date for example in “hm_date”: May 1, 2012.

I need “total_days” to show the total days between May 1, 2012 at the current date.

I want to achieve this on server-side, which is somewhat new to me.

I need to create a TRIGGER to always have “total_days” updated

I started with this and I’m having trouble making a trigger and getting it correct:

SELECT DATEDIFF(curdate(),hm_date) as total_days FROM reg_add

Any help would be appreciated.

Erik

  • 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-03T22:45:50+00:00Added an answer on June 3, 2026 at 10:45 pm

    Erik, I am using tsql, and not as familiar with mySQL, but in tsql the DATEDIFF function requires 3 parameters. The sytax is

    DATEDIFF(date part, date1, date2).

    I would try DATEDIFF(d,GETDATE(),hm_date) AS total_days FROM reg_add

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

Sidebar

Related Questions

I'm working with Sharepoint 2.0 (WSS2) and need to create a lookup field that
i have this accordion with only one title, that will show an document name
I need to create a view that show employees that have their Service anniversary
I need to create a report using SQL Server 2008R2 Stored procedure that will
i have a table dates (dob date, age number(4) ); I will insert a
I have been told to create a query that will show the top 10
I am trying to create a fieldset that will append a file input field
I need to create a form that has many of the same fields, that
I need to create a decimal field in MsAccess 2003 through DAO. How do
I need to create an excel sheet with a field status. It is a

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.