Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 how can i fix this query ?? it is giving error

Author  Topic 

cqldba303
Starting Member

16 Posts

Posted - 2011-07-12 : 15:41:29
Can you tell what is wrong in this query ?

UPDATE DWH
sum(
ISNULL (aBCS,0)+
ISNULL (bISS,0)+
ISNULL (cITO,0)+
ISNULL (Other,0)) as Total
WHERE ID=20110225


Basically I have database table with columns and total is calculation of those columns. I updated the column but total column didn't get updated. so i need to run this query to update total column.

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2011-07-12 : 15:54:16
maybe:


UPDATE DWH

From DWH A
Inner Join

Select Id, total =
sum(
ISNULL (aBCS,0)+
ISNULL (bISS,0)+
ISNULL (cITO,0)+
ISNULL (Other,0)) as Total
WHERE ID=20110225
Group By ID
) B



Corey

I Has Returned!!
Go to Top of Page
   

- Advertisement -