Home » SQL & PL/SQL » SQL & PL/SQL » Date function help
Date function help [message #20433] Thu, 23 May 2002 07:31 Go to next message
Lori Downing
Messages: 1
Registered: May 2002
Junior Member
I am trying to get the last date from a column in a table. I have a column called time_stamp in a table we use to monitor application usage. There are numerous entries for each person since they sign on quite a bit. I need to get the last time_stamp to see when the last time they logged on so I can use it in another query. Any help would be great!
Re: Date function help [message #20434 is a reply to message #20433] Thu, 23 May 2002 07:56 Go to previous messageGo to next message
oxkar
Messages: 9
Registered: May 2002
Junior Member
It could be something like that:

SELECT A.USER_COLUMN_NAME, A.TIME_STAMP
FROM YOUR_TABLE A, OTHER_TABLES....
WHERE A.TIME_STAMP=
(SELECT MAX(B.TIME_STAMP) FROM YOUR_TABLE B
WHERE B.USER_COLUMN_NAME=A.USER_COLUMN_NAME) AND
REST_OF_JOINS...
Re: Date function help [message #20453 is a reply to message #20433] Sat, 25 May 2002 08:19 Go to previous messageGo to next message
N. Rammohan
Messages: 5
Registered: May 2002
Junior Member
select user,to_char(time_stamp,'yyyymmddhh24miss')
from table1 t1 where time_stamp=(select
max(to_char(time_stamp,'yyyymmddhh24miss')) from
table1 t2 where t1.user=t2.user and
t1.time_stamp=t2.time_stamp)
group by user,to_char(time_stamp,'yyyymmddhh24miss')

pl try this and revert back
Re: Date function help [message #20462 is a reply to message #20433] Sat, 25 May 2002 21:57 Go to previous message
Amit
Messages: 166
Registered: February 1999
Senior Member
--Try the most simple one

select ename,max(hiredate)
from emp
group by ename
Previous Topic: Performance Issue
Next Topic: How to get Out parameter from Oracle stored proc with a package by ADO (Visual basic )
Goto Forum:
  


Current Time: Thu Apr 25 12:04:57 CDT 2024