I have a table (TableA) that needs to have a date field updated with a MAX(Date) from another table (TableC).
To add to this ... We need to join to a TableB to get an ID to have it hook up right.
So TableA looks like:
DBName varchar(100),
CreateDate DateTime
TableB looks like:
DBName varchar(100)
DBID Int
TableC looks like:
DBID Int
DateCreated DateTime
So I have attempted something like this (but of course it does not work) ... What am I missing.
Hope this makes sense.
Thanks ALL
Thanks
J. Kusch
To add to this ... We need to join to a TableB to get an ID to have it hook up right.
So TableA looks like:
DBName varchar(100),
CreateDate DateTime
TableB looks like:
DBName varchar(100)
DBID Int
TableC looks like:
DBID Int
DateCreated DateTime
So I have attempted something like this (but of course it does not work) ... What am I missing.
Code:
UPDATE TableA
SET DateCreated = ( SELECT MAX(c.DateCreated)
FROM TableA AS a
JOIN TableB AS b
ON (a.DBName = b.DBName)
JOIN TableC AS c
ON (b.DBID = c.DBID) )
Hope this makes sense.
Thanks ALL
Thanks
J. Kusch