Re: How to retrieve latest record when date and time are separate ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JN

    Re: How to retrieve latest record when date and time are separate ?

    Thanks to all, who answered. Sorry for the simple formulation. I also
    found one solution (similar to Daniel Roy's).

    SELECT PERSON_ID,
    MAX(DATE_COLUMN + (TIME_COLUMN - TO_DATE('1970-01-01',
    'yyyy-mm-dd')) )
    FROM ATTENDANCE
    GROUP BY PERSON_ID

    But I doubt about whether indexes on date and time columns (both in my
    or D.Roy's solution) are used. Am I able to find out whether they are
    used ?
    I use standard utilities ( Sql Plus Worksheet, DBA studio, Toad).

    J.N.

    jirinej@volny.c z (JN) wrote in message news:<7e29a94a. 0307090205.179b ca49@posting.go ogle.com>...
    I record attendance of persons to table with these columns:
    PERSON_ID, DATE, TIME, CODE .
    Is it possible to write SQL query, which gives me latest record of all
    persons? Unfortunately, the DATE and TIME are separate columns.
    Thanks for any ideas.
Working...