Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2012
    Posts
    54
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Search by one column to add text at the end of another

    I've found this link: http://stackoverflow.com/questions/1...-a-text-column

    Which shows me how to add text to the end of a field when searching in that field. However, what I am wanting to do is search 1 field (which is a URL containing field) for a specific string of text, and if it exists, insert some text at the end of another field in the same row.

    Field Names: dsptxt and lnktxt

    If it finds www.exampleurl.com in lnktxt
    then insert HI There at the end of the existing data in dsptxt.

    Not sure if possible, but I imagine it is...just not able to figure out how to edit the queries listed in the example link I provided. Any help would be appreciated.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,121
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Code:
    UPDATE nameOfYourTable
    SET dsptxt = CONCAT( dsptxt, ' HI There' )
    WHERE lnktxt LIKE '%www.exampleurl.com%'
    ???

    Is that all? Or do you mean something more specific?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    mharrison (12-22-2012)

  • #3
    New Coder
    Join Date
    Dec 2012
    Posts
    54
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    Code:
    UPDATE nameOfYourTable
    SET dsptxt = CONCAT( dsptxt, ' HI There' )
    WHERE lnktxt LIKE '%www.exampleurl.com%'
    ???

    Is that all? Or do you mean something more specific?

    That was it exactly! Thank you very much for the help!


  •  

    Posting Permissions

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