Ernesto
asked on
Achive an Update!
Please guys i need to achive an update to a table
the error
An aggregate may not appear in the set list of an UPDATE statement.
Please you help me experts!
update actividades1 set codigo= SUM(CAST(a.hrs as decimal(15,1))) from hrsh a, actividades b where b.descripcion=a.disciplina and a.actividad=b.actividad
the error
An aggregate may not appear in the set list of an UPDATE statement.
Please you help me experts!
update actividades1
set codigo= (
Select SUM(CAST(a.hrs as decimal(15,1)))
from hrsh a, actividades b
where b.descripcion=a.disciplina
and
a.actividad=b.actividad
)
set codigo= (
Select SUM(CAST(a.hrs as decimal(15,1)))
from hrsh a, actividades b
where b.descripcion=a.disciplina
and
a.actividad=b.actividad
)
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
set codigo= cj1.hrs_sum
from actividades1 a1
cross join (
select SUM(CAST(a.hrs as decimal(15,1))) as hrs_sum
from hrsh a, actividades b
where b.descripcion=a.disciplina
) as cj1