Date function help [message #20433] |
Thu, 23 May 2002 07:31 |
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 |
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 |
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
|
|
|
|