I have a MySQL table called Cars
. The Cars
table has three columns: id int auto increment
, foo varchar(255)
, bar varchar(255)
.
I want to simply update all rows in the Cars table into the bar
column with the same value from foo
if foo
is not null. So both foo and bar will have the same value after the update wherever foo is not null.
update cars set
bar = foo
where foo is not null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With