Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-22-2012, 03:45 AM   PM User | #1
mharrison
New Coder

 
Join Date: Dec 2012
Posts: 52
Thanks: 12
Thanked 0 Times in 0 Posts
mharrison is an unknown quantity at this point
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.
mharrison is offline   Reply With Quote
Old 12-22-2012, 04:52 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
mharrison (12-22-2012)
Old 12-22-2012, 05:30 PM   PM User | #3
mharrison
New Coder

 
Join Date: Dec 2012
Posts: 52
Thanks: 12
Thanked 0 Times in 0 Posts
mharrison is an unknown quantity at this point
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!
mharrison is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:23 PM.


Advertisement
Log in to turn off these ads.