zel
zel

Reputation: 165

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?

Upvotes: 0

Views: 36

Answers (3)

Krishna Gupta
Krishna Gupta

Reputation: 685

UPDATE lime_answers SET `answer` = 'bigpony' WHERE (`answer` = 'littlepony' AND `language` = 'en')

Use this

Upvotes: 1

ravi sharma
ravi sharma

Reputation: 21

Try this


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

Upvotes: 2

Christian
Christian

Reputation: 827

Try to use

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

Upvotes: 1

Related Questions