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 2000 Forums
 Transact-SQL (2000)
 Update Problem

Author  Topic 

daipayan
Posting Yak Master

181 Posts

Posted - 2010-03-12 : 03:48:49
I am having following update trigger:
UPDATE dbo.average
set dbo.average.average = jcd.[Total Average], dbo.average.feedback = jcd.[No. of Feedback]
from dbo.average INNER JOIN
(Select CONVERT(decimal(15, 2), (AVG(q1) + AVG(q2) + AVG(q3) + AVG(q4) + AVG(q5) + AVG(q6) + AVG(q7) + AVG(q8)) / 8.0) AS [Total Average], COUNT(ID) AS [No. of Feedback] FROM dbo.job_content_design
group by dept) jcd
on dbo.average.dept_group = 'A' and dbo.average.dept = jcd.dept


Everything is OK here, except last line cause whenever am trying to run this query, am getting following error message:
Server: Msg 207, Level 16, State 3, Line 1
Invalid column name 'dept'.


Please help!

Daipayan

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-12 : 03:57:12
Take dept into the select list of your derived table.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -