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 |
|
lekfir
Starting Member
3 Posts |
Posted - 2008-12-12 : 04:06:46
|
| Hello,I try to update Table1 basedon data in Table2For Example:Set Col1.Table1='OK'Case Col2.Table1 exists in Col2.Table2Col2.Table has ~ 1000 rows with numbers...How can I perform this action?Thanks! |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-12 : 04:09:09
|
[code]UPDATE t1SET t1.Col1 = 'OK'FROM Table1 AS t1INNER JOIN Table2 AS t2 ON t2.Col2 = t1.Col2[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2008-12-12 : 04:31:53
|
| Update t1set t1.col1 = 'ok'from Table1 t1where t1.col2 IN (select col2 from Table2) |
 |
|
|
Jai Krishna
Constraint Violating Yak Guru
333 Posts |
Posted - 2008-12-12 : 04:36:12
|
| UPDATE t1SET t1.col1 = 'OK'FROM Table1 AS t1WHERE EXISTS(SELECT col2 FROM Table2 t2 WHERE t2.col = t1.col)Jai Krishna |
 |
|
|
|
|
|