clear column

Discussion in 'MySQL' started by bumbar, Jun 17, 2009.

  1. #1
    I have a column in MySQL table. I want to delete a phrase that is repeated in all records of the column

    example of the column:

    267000 <a href="http
    34600 <a href="http
    54890 <a href="http
    211100 <a href="http

    this expression I want delete '<a href="http'


    I tried this
    
    update col set price= replace (price, '<a href="http', '') ;
    
    PHP:
    my be REGEX??

    but all records are replaced by price

    I want to remain only number

    Thanx!
     
    bumbar, Jun 17, 2009 IP
  2. ven

    ven Member

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #2
    Well just change price column to integer?
    ALTER TABLE `col` CHANGE `price` `price` INT( 10 ) NOT NULL

    Only numbers will remain.
     
    ven, Jun 17, 2009 IP
  3. livedating

    livedating Active Member

    Messages:
    161
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    83
  4. gauravajitsaria

    gauravajitsaria Peon

    Messages:
    309
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i think the idea given by ven is good. but it will not allow u to add any characters later on if u do want to.
    its better to use the way suggested by livedatesearch as it will crop the entry and let only the numbers remain as well as retain the property of the column.
     
    gauravajitsaria, Jun 24, 2009 IP