Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Update Column with Percentages

695832May 7 2009 — edited May 7 2009
I have a table implemeneted in a table, the column is call averages and as you can imagine i would like to fill this with percentages from the stored numbers in the table.

This is the table

Column Name Data Type Nullable Default Primary Key
PLAYER_ID NUMBER(4,0) No - 1
CONTRACT_ID NUMBER(4,0) Yes - -
FORENAME VARCHAR2(30) Yes - -
SURNAME VARCHAR2(30) Yes - -
TEAMNAME VARCHAR2(30) Yes - -
PLAYED NUMBER(10,0) Yes - -
WINS NUMBER(10,0) Yes - -
LOSES NUMBER(10,0) Yes - -
AVERAGES NUMBER(10,0) Yes - -

I tried the following statement,

update player set averages = sum(wins/played)*100;


The above statement give me the ORA-00934: group function is not allowed here error, is there any way of populating the column using the sum statement?

The table has 112 rows.

I can return the percentages using the follow statement,

select player_id, sum(wins/played)*100 as "percentage"
from player
group by player_id
having sum(wins/played)*100 > 50;

I cannot think of a way to save the return from the query.

Edited by: InvaderTak on 07-May-2009 15:19
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 4 2009
Added on May 7 2009
1 comment
764 views