Skip to Main Content

SQL & PL/SQL

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!

Need to get SUM of total cost as Final Cost

AB115Nov 23 2017 — edited Nov 23 2017

Hi All,

we have a requirement as per below,

Create table:

create table emp_test (emp_id number ,queue_name varchar2(50),qty number,price number)

/

Insert statements:

insert into emp_test values (1,'HPP',10,10)

/

insert into emp_test values (2,'Chemical',20,20)

/

insert into emp_test values (3,'Lighting',30,30)

/

insert into emp_test values (4,'SP',40,40)

/

insert into emp_test values (5,'AS',50,50)

/

commit

/

Based on above statements, we need output as below,

Emp_id | Queue_Name | Total_Cost | Final_Cost

1            |  HPP                | 100             |  5600

2            |  Chemical        |  400            |  5600

3            |  Lighting          |  900            |  5600

4            |  SP                  |  1600          |  5600

5            |  AS                  |  2500          |  5600

This post has been answered by mNem on Nov 23 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 21 2017
Added on Nov 23 2017
19 comments
983 views