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 |
j_kathiresan
Starting Member
3 Posts |
Posted - 2014-09-25 : 03:28:27
|
Hi,I have two tables table1 and table2 and having a common column "col1"When i ran the following query UPDATE table1, table2 SET col1=FALSE WHERE id = 1;getting the following errorError Code: 1052Column 'col1' in field list is ambiguousid column exist in both the tables and need to update both the tables to false where the id is equivalent to 1.could you please help me on how to achieve this in single query?Thanks. |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2014-09-25 : 04:02:38
|
You need two update statements:UPDATE TABLE1SET COL1='FALSE'WHERE ID = 1UPDATE TABLE2SET COL1='FALSE'WHERE ID = 1Harsh Athalyehttp://www.letsgeek.net/ |
|
|
j_kathiresan
Starting Member
3 Posts |
Posted - 2014-09-25 : 05:26:25
|
Is it possible in one single SQL? |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2014-09-25 : 06:54:09
|
No.Why do you want it to be done in single sql?Harsh Athalyehttp://in.linkedin.com/in/harshathalye/ |
|
|
|
|
|