Google Answers Logo
View Question
 
Q: MySQL Programming ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: MySQL Programming
Category: Computers > Programming
Asked by: mhffs-ga
List Price: $5.00
Posted: 27 Dec 2002 10:58 PST
Expires: 26 Jan 2003 10:58 PST
Question ID: 133974
Hi,
I have a database: "database1"
with a table: "news"
In news there is a field: "link" which contains urls.
I would like the query that will look at link to see if it contains
"http://www.myweb.com/track/track.php?" if it does do nothing.  If it
does not then I would like to append this to the beginning of the
existing URL.

I believe the query looks something like this:

UPDATE news 
SET link = 'http://www.MyWeb.com/track/track.php?' + link 
WHERE link not like '%www.myweb.com/track/track.php?%';

but it isn't producing the proper result.
Hope you can help.

Thanks,
Martin
Answer  
Subject: Re: MySQL Programming
Answered By: webadept-ga on 27 Dec 2002 11:58 PST
Rated:5 out of 5 stars
 
Hi, 

You want to use the concat function for this. Example:

update news
set link = concat("http://www.myweb.com/track/track.php?", link)
where link not like '%www.myweb.com/track/track.php?%';

Thanks, 

webadept-ga
mhffs-ga rated this answer:5 out of 5 stars
Thanks.  Perfect answer & fast.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy