Reputation: 441
I want to update the 'status' column of the table with respective id , but it leads me to error code 1093. Below is my SQL Query
Update site_html Set status='Update Found'
Where id = (
select id
from site_html
where link='http://www.example.com');
How can i correct this error? I am new to SQL .
Upvotes: 1
Views: 1027
Reputation: 1219
In MySQL, you can't modify the same table name directly which you use in the SELECT part. So you can do it through table alias.
update site_html AS s, (select id from site_html where link='http://www.example.com') AS t
set status='Update Found'
where s.id = t.id;
Upvotes: 3