SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2011
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    calculating date on the fly

    I have a column "submition_date" type DATE and also a column "Elapsed_time"
    Question is - is it possible to calculate the date difference in days from "submition_date" to current date and display the values In "elapsed_time"

    So basically column "elapsed_time" would always have an updated value in it.

    Probably a very simple question for most of you, any help or pointers are much appreciated.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,330
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    yes, you can do this type of calculation, but why would you store it in a column? it's just going to be wrong tomorrow
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member
    Join Date
    May 2011
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi r937,

    Exactly, yes im able to calculate it and store it in a column, but i want to do the calculation on the fly so that the column has "fresh" values every time. makes sense?

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,330
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    sorry, no, it doesn't make sense

    just do the calculation, and forget about storing the result
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •