timestamp issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hathewj
    New Member
    • Jan 2008
    • 3

    timestamp issue

    OK I have another problem.
    I want to automate a query to run and pull all new info as of the day before. So, when i run it I want it to do this:

    where timestamp= current date timestamp- 1 day.
    but i want it to run it as of midnight today - 1 day
    I am having trouble explaining this and I am sorry.
    JH
  • sakumar9
    Recognized Expert New Member
    • Jan 2008
    • 127

    #2
    I am sorry I couldn't understand your exact problem. It looks like you need to play with CURRENT TIMESTAMP register.

    select * from aa where TS = CURRENT TIMESTAMP - 2 DAYS

    You can also manipulate using number of hours.


    Regards
    -- Sanjay

    Comment

    • docdiesel
      Recognized Expert Contributor
      • Aug 2007
      • 297

      #3
      Hi,

      you could calculate the date of yesterday and today, concatenate it with '00.00.00' as time expression and convert that in total to a datestamp:

      Code:
      SELECT
        ...
      FROM
        ...
      WHERE
        datefield >= datestamp(current_date - 1 day || '-00.00.00')
      and
        datefield <  datestamp(current_date || '-00.00.00')
      ;
      Regards,

      Bernd

      Comment

      Working...