zel zel - 1 year ago 67
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 Source

Try to use

update lime_answers set answer = 'bigpony' where answer = 'littlepony' AND language = 'en'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download