zaggs — 2011-03-14T14:44:27-04:00 — #1
I am trying to add a value to the beginning of a field in my database (there are over 20,000 rows, so it's impossible to do manually).
I tried the following query, which added the value to the end of the field. Is there a way to add it to the beginning of a field like a prefix.
update users set cv = CONCAT(cv, 'uploads/users/cvs/');
system — 2011-03-14T15:18:51-04:00 — #2
update users set cv = CONCAT('uploads/users/cvs/', cv);
system — 2011-03-14T15:20:03-04:00 — #3
PS - when running an UPDATE like this, you should always first run it as a SELECT first to ensure you get the results you're looking for.... otherwise you may permanently screw up your DB!!!
SELECT CONCAT('uploads/users/cvs/', cv) FROM users;