I have a table like this
A | B | C <----columns
x 0 | - | -
y 0 | - | -
z 0 | - | -
I want to replace all the 0 with -, something like a foreach would do it, but I want to do it with SQL (if possible).
In my actual problem here theres hundreds of rows, so by hand would be bad lol. I could probably crack it with some php but I suspect theres a thingy in MySQL that does this.
Do you just mean
update mytable set A="-" where A="0";
?
update table tablename set A="-" where A="0"
Are you looking for this?
UPDATE mytable
SET a = 123
WHERE a = 0
Or replace 123 with whatever you want, like '-'.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.