Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Find the record with the latest timestamp

HesipesiMar 19 2013 — edited Mar 19 2013
Hi,

i have a table which has four fields.


CREATE TABLE MATCH_L
(
SUBSCRIPTION_INFO VARCHAR2(512 BYTE),
SUBSCRIBERID NUMBER NOT NULL,
USERID VARCHAR2(12 BYTE) NOT NULL,
TIME_LAST_USED TIMESTAMP(6) NOT NULL
)
TABLESPACE TEST1
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;



For every couple of records its like below

FSB0004609 42 192902070016 2012-05-03 10:30:33,011000
FSB0004609 42 192902070016 2012-04-19 14:30:33,627000
FSB0004609 42 192902070016 2012-04-03 16:28:16,019000
FSB0004609 42 192902070016 2012-03-21 17:11:04,398000
FSB0004609 42 192902070016 2012-04-30 09:12:40,366000


SUBSCRIPTION_INFO , SUBSCRIBERID , USERID are the same and they just differe in time stamp.

So i want to get hold of one of these "every couple of records" which is having the latest TIME_LAST_USED.

I hope you have understood what i want (in another interpretation i want to have a distinct SUBSCRIPTION_INFO , SUBSCRIBERID , USERID but not by using distinct in query)

Please let me know if my explanation is not enogh.

Regards

/ Hesam

Edited by: Hesam on Mar 19, 2013 3:01 PM
This post has been answered by Solomon Yakobson on Mar 19 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 16 2013
Added on Mar 19 2013
3 comments
5,334 views