Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Posts
    2

    Unanswered: SQl info for Time Query

    I have a database called dx_data. There is a field in it called dx_dati that is a date and time field. As a user enters a record in the database, this field is stamped with the system date & time.
    What I require is a query to list all the records in the database that are within 30 minutes of the current system time. I am using a Postgres database (fairly new version).

  2. #2
    Join Date
    Dec 2003
    Posts
    74

    Re: SQl info for Time Query

    select to_char(sysdate,'DD-MON-YYYY HH:MI') normal_time,to_char(sysdate-1/48,'DD-MON-YYYY HH:MI') time_minus_30_mins from dual;

    TO_CHAR(SYSDATE,' TO_CHAR(SYSDATE-1
    ----------------- -----------------
    06-JAN-2004 10:40 06-JAN-2004 10:10
    Last edited by edwinjames; 01-06-04 at 09:20.

  3. #3
    Join Date
    Dec 2003
    Posts
    74
    SELECT * FROM dx_dati WHERE DATE_FIELD => sysdate-1/48

    THIS WILL RETURN ALL RECORDS TIMESTAMPED OVER THE PASS HALF HOUR

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Originally posted by edwinjames
    SELECT * FROM dx_dati WHERE DATE_FIELD => sysdate-1/48

    THIS WILL RETURN ALL RECORDS TIMESTAMPED OVER THE PASS HALF HOUR
    Unfortunately, the poster is using Postgres, not Oracle.

  5. #5
    Join Date
    Jan 2004
    Posts
    2
    Okay, I can see where this may be a problem with postgres. Not sure why, but maybe there is a simpler work around.
    Would it be easier to have a query where I get a listing of the most recent 25 entries in the database?

Posting Permissions

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