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.
Author |
Topic |
richcol
Starting Member
5 Posts |
Posted - 2007-03-26 : 06:16:53
|
Hi all,could someone give me advice on how to finish this update query?Update Tempclmset status = 99 whereselect Clm.Date, Ggr.Code from Clminner join Clion Clm.clid = cli.clidinner join Ggron Clm.AID = Ggr.AIDwhere exists(select ref, Clmdate from TempClmwhere ref = Ggr.Codeand clmdate = Cli.ClmDate)I basically want the update to set the status column to 99 where the code and date match for each row returned by the select query.At the moment it is just updating all rows with the value 99.any ideas appreciated. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-26 : 06:20:29
|
I have no idea how to bind the two queries together, but the basic idea is thisUPDATE x1SET x1.Status = 99FROM Table1 AS x1INNER JOIN Table2 AS x2 ON x2.SomeCol = x1.SomeCol Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|