zel zel - 1 month ago 5
MySQL Question

MySQL update value in column when there is particular text in two other

I have phpmyadmin page and I must alter many rows in my database. I have table 'lime_answers', and inside I have answer and language columns. What I want to do is to update all answers that are, lets say "littlepony" to "bigpony", but only when language column has "en" in that row. So something like

SELECT * FROM 'lime_answers' WHERE ('answer' = 'littlepony' AND 'language' = 'en')
then SET 'answer' = 'bigpony'


Is this possible?

Answer

Try to use

update lime_answers set answer = 'bigpony' where answer = 'littlepony' AND language = 'en'