Dear Maya,
Sepertinya dgn. SQL script murni tidak bisa kita dapatkan hasil query
spt itu. Tapi dengan pakai PL/SQL script hal itu akan sederhana. Kalo
nggak salah, itu logikanya mirip dengn DERET FIBONACCI.
select no, value from t;
NO VALUE
---- ---------
1 10
2 15
3 20
set serveroutput on;
declare
cursor Ada is
select no, value from t;
Nval number(2);
begin
dbms_output.put_line('no Nilai');
for i in ada loop
if i.No= 1 then Nval:=i.Value;
else
Nval :=Nval+i.Value;
end if;
dbms_output.put_line(i.no||' '||Nval);
end loop;
end;
Hasilnya:
no Nilai
1 10
2 25
3 45
Semoga membantu.
regards,
(Dean)
--- In [email protected], "mayanti" <[EMAIL PROTECTED]> wrote:
>
> Dear All
>
> Bantuin aku dong,
>
> misal contoh table
>
> no nilai
> 1 10
> 2 15
> 3 20
>
> bagaimana cara membuat query sehingga menghasilkan keluaran spt di
bawah ini
>
> no nilai
> 1 10
> 2 25
> 3 45
>
> atas bantuannya saya ucapkan terima kasih
>
> maya
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/PhFolB/TM
--------------------------------------------------------------------~->
--
-----------I.N.D.O - O.R.A.C.L.E---------------
Keluar: [EMAIL PROTECTED]
Website: http://indo-oracle.lizt.org (NEW)
-----------------------------------------------
Bergabung dengan Indonesia Thin Client User Groups,
Terminal Server, Citrix, New Moon Caneveral, di:
http://indo-thin.vze.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/indo-oracle/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/