SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding data without deleting

    Is it possible to add data to a field/column without deleting the content already there? I managed to do it with integers but not text. I tried
    Code:
    UPDATE table1 SET columndata = columndata + 'test' where columnid = '1';
    but the value just changed to '0'. My columndata type is varchar. Do I have to change this to something special or is this operation impossible?

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use the CONCAT() function to concatenate strings:
    Code:
    UPDATE table1 SET columndata = CONCAT(columndata, 'test') where columnid = '1';


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •