<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Blog of Angelo &#187; select</title>
	<atom:link href="http://angelo.mandato.com/tag/select/feed/" rel="self" type="application/rss+xml" />
	<link>http://angelo.mandato.com</link>
	<description>where logic becomes print</description>
	<lastBuildDate>Mon, 31 Oct 2011 16:12:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Converting URL to Local File Path in Batch MySQL INSERT Query Using SUBSTRING_INDEX() and CONCAT()</title>
		<link>http://angelo.mandato.com/2009/01/05/converting-url-to-local-file-path-in-batch-mysql-insert-query-using-substring_index-and-concat/</link>
		<comments>http://angelo.mandato.com/2009/01/05/converting-url-to-local-file-path-in-batch-mysql-insert-query-using-substring_index-and-concat/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 21:28:46 +0000</pubDate>
		<dc:creator>Angelo</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[concat]]></category>
		<category><![CDATA[insert]]></category>
		<category><![CDATA[insert from select]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[select]]></category>
		<category><![CDATA[substring_index]]></category>

		<guid isPermaLink="false">http://www.compiledweekly.com/?p=114</guid>
		<description><![CDATA[I wanted to quickly take a URL (e.g. http://www.compiledweekly.com/somefolder/somefile.ext) and translate it to the local path (e.g. /home/user/public_html/somefolder/somefile.ext) while inserting multiple records into a new table. My first thought was to select all the records, use PHP to trim off the path, then insert the new record in the new table. There&#8217;s a better answer, [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to quickly take a URL (e.g. http://www.compiledweekly.com/somefolder/somefile.ext) and translate it to the local path (e.g. /home/user/public_html/somefolder/somefile.ext) while inserting multiple records into a new table. My first thought was to select all the records, use PHP to trim off the path, then insert the new record in the new table. There&#8217;s a better answer, use SUBSTRING_INDEX() and CONCAT() with a INSERT INTO table SELECT statement.</p>
<p style="padding-left: 30px;">INSERT INTO new_table<br />
SELECT CONCAT(&#8216;/home/user/public_html/somefolder/&#8217;, SUBSTRING_INDEX(s.url, &#8216;/&#8217;, -1)) AS local_path<br />
FROM source_table AS s<br />
WHERE &#8230;</p>
<p>It does the job with out having to write a single line of PHP code!</p>
]]></content:encoded>
			<wfw:commentRss>http://angelo.mandato.com/2009/01/05/converting-url-to-local-file-path-in-batch-mysql-insert-query-using-substring_index-and-concat/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

