Reputation: 133
I want to update a table with replaced values of a specific field in MySQL. Below is my query.
Update tableA
set email=(SELECT replace(email,'www.','') FROM tableA WHERE email like "www%" and
email like "%@%" and website="")
But it gives me an error that
You can't specify target table for update in from clause
I've tried using inner join but getting the same error again and again. Please guide me where am I mistaking?
Upvotes: 1
Views: 41
Reputation: 44766
No need to use a sub-query:
Update tableA
set email= replace(email,'www.','')
WHERE email like "www%" and email like "%@%" and website=""
Upvotes: 2