-
HI,
I want top n dates from a table. Say there are 10 different dates and the result must be the top 3 unique dates (in desc order).
Regards
Bunny.
-
select *
from
(select
allcols from yourtable
order by datecol desc)
where
rownum <=3
Rgds
Vijay.s
-
sorry a DISTINCT got missed..
Rgds
Vijay.s
-
Hi,
The table has got code , date and value. The value has to be summed datewise and for my given date the latest three days must be fetched .If i use the ROWNUM then the results will be wrong as GROUP BY has to be used.
Regards
Bunny
Shyla
-
hi,
u hv 2 use RANK() function.
select distinct statement_date from (select statement_date, dense_rank() over (order by statement_date DESC) as rnk1
from account_Statement)
where rnk1 < 4
/
VBHASKAR CODE IS CORRECT U HV 2 ADD DISTINCT ALONE
select *
from
(select DISTINCT
allcols from yourtable
order by datecol desc)
where
rownum <=3
JEGANNATHAN S
Cheers!
OraKid.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|