Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Complex SELECT problem
Hi.
I'm another man having problem with my query. The problem is:
I've table:
id article price on_stock purchase_date
1 1 10 Y 2004-02-02 2 2 5 Y 2004-01-02 3 1 11 Y 2003-12-07 4 1 9 N 2004-02-02 5 2 5 N 2004-01-02 6 3 11 Y 2003-11-17
and question:
SELECT article, price, decode(on_stock, 'Y', 'Yes', 'N', 'No') WHERE purchase_date BETWEEN %start and end date% ORDER BY article
so, i get
article price on_stock purchase_date
1 10 Y 2004-02-02 1 11 Y 2003-12-07 1 9 N 2004-02-02 2 5 Y 2004-01-02 2 5 N 2004-01-02 3 11 Y 2003-11-17
but I need sub sum for prices of every article, like this: article price on_stock purchase_date
1 10 Y 2004-02-02 1 11 Y 2003-12-07 1 9 N 2004-02-02 subsum 30 2 5 Y 2004-01-02 2 5 N 2004-01-02 subsum 10 3 11 Y 2003-11-17 subsum 11
Is it possible, to get this result in select statement? Now I'm making this by processing answer in programming language...
Thx a lot
Pawel Dulak Received on Mon Mar 08 2004 - 11:43:58 CST