Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> SQL Query - Sum

SQL Query - Sum

From: Toshi Teruya <tteruya_at_sportsmail.com>
Date: 2000/04/26
Message-ID: <8e715f$6do$1@nnrp1.deja.com>#1/1

Test table as follows:

paid



25
25
50
50

I would like to execute a query to return the following:

paid total
---- -----

25      150
25      150
50      150
50      150

The following query below works in MS Access:

select paid, (select sum(t.paid) from test t) as total from test;

But the query does not work in Oracle. An ORA-00936: missing expression occurs.

I would prefer not to add a total column and run an update statement to sum since the table size will change. I would also prefer not to use a function. If anyone knows of any other way...

Thanks in advance,

Toshi

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Apr 26 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US