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
 General SQL Server Forums
 New to SQL Server Programming
 calculated column

Author  Topic 

aidmondo
Starting Member

23 Posts

Posted - 2012-05-25 : 08:24:49
Create table tableA (tableAID int identity(1,1), Column2 varchar(200), Column3 money)

Create table tableB (tableBID int identity, tableAID int foreign Key(#above), Thirdcolumn int)

Create table tableC (tableCID int identity, tableBID int foreign key (#above), tableCNo int)

tableCNo = Column3(#from tableA) + Thirdcolumn(#fromtableB). Help

aidmondo

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-05-25 : 08:27:42
There is no relation between tableC and the other tables.


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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-25 : 09:42:54
[code]
UPDATE c
SET tableCNo = COALESCE(a.Column3,0) + COALESCE(b.Thirdcolumn ,0)
FROM tableC c
INNER JOIN tableB b
ON b.tableBID = c.tableBID
INNER JOIN tableA a
ON a.tableAID = b.tableAID
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-05-25 : 10:01:15
ok - NOWS there is a relation


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

- Advertisement -