SQL Language (MOSC)

MOSC Banner

Update with group by in subquery

in SQL Language (MOSC) 2 commentsAnswered ✓

create table a1 (id varchar2(20), sal number(3));

insert into a1('a',1);

insert into a1('b',2);

insert into a1('c',3);


create table a2 (id varchar2(20), sal number(3));


insert into a2('a',1);

insert into a2('a',5);

insert into a2('b',8);


Now we've to update a1.sal with sum(b1.sal) like

update a1 set sel=select sal from(

select id,sum(sal)sal from a2 group by id) b

where a1.id=b.id;

how can we do that...?

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center