SQLTeam.com | Weblogs | Forums

How to correct this statement


#1

Hello

i have the following statement and i don't know where my errror is?
can you help pleasE?
thank you

UPDATE ADPU_Daten_Calcvals
SET
[sum_Failures_B_monthly(excl)] =
( select sum(SUpdateColSource1)
FROM (select distinct offline_date,Bereich,Failures_Bereich_exklNA
as SUpdateColSource1 from ADPU_Daten_Calcvals) a group by
a.Bereich,month(a.Offline_date),YEAR(a.Offline_date))

the error is :


#2

the error is: more than one value is returned from sub query


#3

hi,

seems your distinct returns more than one result set.

UPDATE ADPU_Daten_Calcvals
SET
[sum_Failures_B_monthly(excl)] =
(
select top 1 sum(SUpdateColSource1)
FROM (
select distinct offline_date,Bereich,Failures_Bereich_exklNA as SUpdateColSource1
from ADPU_Daten_Calcvals) a group by
a.Bereich,month(a.Offline_date),YEAR(a.Offline_date))

Thanks
Subha