Oracle 10.2.0.1.0
Os. Win 2003 server
Hi,
I have this 2 table :
Create table cst(codcli varchar(10) not null,codprod varchar(10) not null,qta numeric);
Create table prodprice(codprod varchar(10) not null,data date not null,price numeric);
create index prodpriceka (codprod,data);
i want select for every customer and product in table cst the last price in table prodprice.
The table prodprice contains millions of rows, a row for every day for every product for a lot of years.
i try :
select codcli,codprod,qta,(select /*+ INDEX_DESC(PRODPRICE PRODPRICEKA) */ price from prodprice
where codprod=t.codprod and data<=trunc(sysdate) and rownum=1) myprice
from cst t
there is a better solution ?
Thanks