-3

Can we use where clause in update by fetching values from other table in where clause.

  • 2
    Possible duplicate of [How to UPDATE from a SELECT in SQL Server?](http://stackoverflow.com/questions/2334712/how-to-update-from-a-select-in-sql-server) – J.N. May 11 '17 at 09:21
  • Well, it depends on what you're trying to do. Show us your query attempt! – jarlh May 11 '17 at 09:24

1 Answers1

0

Several options, provide more info by editing your question for better responses...

update MyTable
set MyColumn = 'Chicken Nuggets'
where SomeColumn in (select SomethingElse from AnotherTable)

Or an exists (a better choice):

update MyTable
set MyColumn = 'Chicken Nuggets'
where exists (select 1 from SomeOtherTable where SomethingElse = SomeColumn)
JohnHC
  • 10,935
  • 1
  • 24
  • 40