Hi,
I have a select statement which selects just one record among many records sorted by timestamp!
SELECT isin, id , mkt , ccy,TM
FROM
( SELECT isin, id , mkt , ccy, TM,
RANK() OVER ( partition by isin order by TM asc ) RNK
FROM testt )
where 'RUSF' = id
and 'SSEFN' = mkt
AND rnk= 1
By this statement i'll get just one record (rnk= 1 so it select the first record)
But the problem is that whenever there is just one record (meeting the conditions) it doesn't show up in the result set!!
And i'll also need that record! My purpose is to always just one record no matter how many they are!
I have attached one sample record and also the table script here!
SE0001 | RUSF | SSEN | SSS | 2013-04-16 06:55:37 |
SE0005 | RUSF | SSEN | SSS | 2013-11-04 06:57:16 |
CREATE TABLE testt
(
ISIN VARCHAR2(13 BYTE) NOT NULL,
ID VARCHAR2(33 BYTE),
TM VARCHAR2(20 BYTE),
TMMILL NUMBER(13),
TMMILLREC NUMBER(13),
NM VARCHAR2(49 BYTE),
MKT VARCHAR2(11 BYTE) NOT NULL,
CCY VARCHAR2(4 BYTE)
)
;