|
Re: get total of records in different row-number [message #389320 is a reply to message #389306] |
Sat, 28 February 2009 09:10 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
amdabd
Messages: 91 Registered: November 2007 Location: My Computer
|
Member |
|
|
hi
I got it,
but still one problem
--
I use a view
CREATE VIEW v_amd (r1, vala, r2, valb)
AS
SELECT ROWNUM, vala, ROWNUM, valb
FROM amd then I use the query
SELECT c.vala, c.valb, a.vala + b.valb
FROM (SELECT r1, vala
FROM v_amd) a,
(SELECT r2, valb
FROM v_amd) b,
(SELECT vala, valb
FROM amd) c
WHERE b.r2 = a.r1 + 1 AND a.vala = c.vala
the output was
![/forum/fa/5820/0/](/forum/fa/5820/0/)
that is what partially I need, however the output should be
VALA VALB val_total
---------- ---------- ----------
1 1 3
2 2 5
3 3 7
4 4 9
5 5 11
6 6
I think my problem within the " Where Clause " in the Query but cannot get it
thanks
-
Attachment: 2.JPG
(Size: 4.06KB, Downloaded 1576 times)
|
|
|
|
|