Mrkay Posted October 25, 2013 Share Posted October 25, 2013 Hi and thanks in advance. Apologies but I'm a newbie at this. I've got a field in a MySql (Place_id) table called Pic. Most of the data in that field is in the form #1234 but some are in the format 1234. What I want to do is strip out the # part of the data in every record of that field in the table that contains it. Can anyone help me with the sql please. Thanks. Link to comment https://forums.phpfreaks.com/topic/283269-field-shorten-in-phpmyadmin/ Share on other sites More sharing options...
PravinS Posted October 25, 2013 Share Posted October 25, 2013 use MySQL replace function in query like this UPDATE Pic SET Place_id = REPLACE(Place_id, '#', '') also do take table backup before doing mass update Link to comment https://forums.phpfreaks.com/topic/283269-field-shorten-in-phpmyadmin/#findComment-1455382 Share on other sites More sharing options...
Mrkay Posted October 25, 2013 Author Share Posted October 25, 2013 I get an error - this is what I did and the response. ErrorSQL query: SELECT * FROM `Pic` UPDATE Pic SET Place_id = REPLACE( Place_id, '#', '' ) LIMIT 0 ,30 MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE Pic SET Place_id = REPLACE(Place_id, '#', '')LIMIT 0, 30' at line 2 Link to comment https://forums.phpfreaks.com/topic/283269-field-shorten-in-phpmyadmin/#findComment-1455388 Share on other sites More sharing options...
Mrkay Posted October 25, 2013 Author Share Posted October 25, 2013 I've sorted it - didn't need the -SELECT * FROM `Pic` Doh. Thank you very much!! Link to comment https://forums.phpfreaks.com/topic/283269-field-shorten-in-phpmyadmin/#findComment-1455392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.