SELECT *
FROM (select currency, datea vdate,valuea value , abs((VALUEb - VALUEa)/valueb)*100 percentdifference
from
(
select A.FROM_CCY_ID currency, A.VDATE DateA, A.VALUE ValueA, B.VDATE DateB, b.value ValueB
from MAIN.INP_EXRATE a, MAIN.INP_EXRATE b
where A.FROM_CCY_ID = B.FROM_CCY_ID
and a.vdate >= to_date(sysdate-100)
and b.vdate >= to_date(sysdate-100)
order by a.vdate desc
) c
where datea = to_date(dateb+1)
order by percentdifference desc)
where rownum <= 25
|