CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   MySQL (http://www.codingforums.com/forumdisplay.php?f=7)
-   -   Search by one column to add text at the end of another (http://www.codingforums.com/showthread.php?t=284537)

mharrison 12-22-2012 03:45 AM

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.

Old Pedant 12-22-2012 04:52 PM

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?

mharrison 12-22-2012 05:30 PM

Quote:

Originally Posted by Old Pedant (Post 1301708)
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!


All times are GMT +1. The time now is 01:06 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.