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!

SQL update sum

Devel007Sep 13 2018 — edited Sep 13 2018

Hi

Could someone tell me how I update field: 0 or 1 in table1 below. In this example Customer 1 should get values 1 in rows one and two, because his sum of amount is bigger than 15 in month 2. Other rows are null in this example.

table1

year     month     customer    amount     0 or 1

2018         2               1             10                           row1

2018         2               1             10                           row2

2018         2               2              3                            row3

2018         2               2              2                            row4

2018         1               2              10                          row5

select year,month,customer,sum(amount)

from table

group by year,month,customer

having sum(amount) > 15

This post has been answered by Cookiemonster76 on Sep 13 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 11 2018
Added on Sep 13 2018
7 comments
1,172 views