<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MySQL replace() function</title>
	<atom:link href="http://www.moe.co.uk/2009/01/08/mysql-replace-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.moe.co.uk/2009/01/08/mysql-replace-function/</link>
	<description>I know I will forget.</description>
	<lastBuildDate>Thu, 24 Feb 2011 22:13:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: jonathan</title>
		<link>http://www.moe.co.uk/2009/01/08/mysql-replace-function/comment-page-1/#comment-6317</link>
		<dc:creator>jonathan</dc:creator>
		<pubDate>Thu, 24 Feb 2011 22:13:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.moe.co.uk/wordpress/2009/01/08/mysql-replace-function/#comment-6317</guid>
		<description>another good one is 

concat()

eg

update [tablename] set [field_name1] = concat([field_name1],[fieldname2])

useful if you have to make keywords or descriptions from other fields


also useful is trim()
eg

select trim(trailing &#039;.png&#039; from [field_name]) will get the image name without the .png on the end too, so you can do

update [tablename] set [field_name2] = trim(trailing &#039;.png&#039; from [table_name])

very useful if importing images somewhere and you have 3 cols of images, small, med and large, etc and all have the same name, just with an _sm etc on the end

that one would be

update [tablename] set [field_name2] = concat(trim(trailing &#039;.png&#039; from [table_name]),&#039;_sm.png&#039;)

then you end up making

image_sm.png in field2 from image.png in field 1</description>
		<content:encoded><![CDATA[<p>another good one is </p>
<p>concat()</p>
<p>eg</p>
<p>update [tablename] set [field_name1] = concat([field_name1],[fieldname2])</p>
<p>useful if you have to make keywords or descriptions from other fields</p>
<p>also useful is trim()<br />
eg</p>
<p>select trim(trailing &#8216;.png&#8217; from [field_name]) will get the image name without the .png on the end too, so you can do</p>
<p>update [tablename] set [field_name2] = trim(trailing &#8216;.png&#8217; from [table_name])</p>
<p>very useful if importing images somewhere and you have 3 cols of images, small, med and large, etc and all have the same name, just with an _sm etc on the end</p>
<p>that one would be</p>
<p>update [tablename] set [field_name2] = concat(trim(trailing &#8216;.png&#8217; from [table_name]),&#8217;_sm.png&#8217;)</p>
<p>then you end up making</p>
<p>image_sm.png in field2 from image.png in field 1</p>
]]></content:encoded>
	</item>
</channel>
</rss>

