Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bulk change all entries for a particular field in SQL database

Tags:

sql

mysql

Let's just say I have a table called TABLE_NAME that looks like this:

id  | name  | changeme
------------------------
1   | One   | 1
2   | Two   | 0
3   | Three | 1
4   | Four  | 0
5   | Five  | 0

Is there an SQL statement I can run on this to change every changeme entry to '0'?

like image 409
Scott Brown Avatar asked Feb 14 '11 09:02

Scott Brown


2 Answers

do you mean?

UPDATE TABLE_NAME SET changeme = 0
like image 163
Adnan Avatar answered Oct 11 '22 04:10

Adnan


update TABLE_NAME set changeme = 0 where changeme = 1 
like image 27
Haim Evgi Avatar answered Oct 11 '22 05:10

Haim Evgi