<?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/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
>

<channel>
	<title>Compiled Weekly &#187; insert from select</title>
	<atom:link href="http://www.compiledweekly.com/tag/insert-from-select/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.compiledweekly.com</link>
	<description>Compiled weekly is a weekly podcast for open source developers. Topics include PHP, MySQL, wxWidgets, NSIS and more.</description>
	<lastBuildDate>Thu, 24 Jun 2010 16:01:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<!-- podcast_generator="Blubrry PowerPress/1.0.8" mode="advanced" entry="normal" -->
	<itunes:summary>Compiled weekly is a weekly podcast for open source developers. Topics include PHP, MySQL, wxWidgets, NSIS and more.

Compiled weekly will soon be covering Android SDK. Stay tuned!</itunes:summary>
	<itunes:author>Angelo Mandato</itunes:author>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.compiledweekly.com/wp-content/themes/angelo2/images/itunes_cw.png" />
	<itunes:owner>
		<itunes:name>Angelo Mandato</itunes:name>
		<itunes:email>compiledweekly@gmail.com</itunes:email>
	</itunes:owner>
	<managingEditor>compiledweekly@gmail.com (Angelo Mandato)</managingEditor>
	<copyright>&#xA9; 2006-2008 Compiled Weekly</copyright>
	<itunes:subtitle>Compiled weekly is a weekly podcast for open source developers. Topics include PHP, MySQL, wxWidgets, NSIS and more.</itunes:subtitle>
	<itunes:keywords>programming, php, mysql, wxwidgets, apache, lighttpd, nsis, web design</itunes:keywords>
	<image>
		<title>Compiled Weekly &#187; insert from select</title>
		<url>http://www.compiledweekly.com/wp-content/themes/angelo2/images/rss_cw.png</url>
		<link>http://www.compiledweekly.com</link>
	</image>
	<itunes:category text="Education">
		<itunes:category text="Education Technology" />
	</itunes:category>
	<itunes:category text="Technology">
		<itunes:category text="Podcasting" />
		<itunes:category text="Software How-To" />
	</itunes:category>
		<item>
		<title>Converting URL to Local File Path in Batch MySQL INSERT Query Using SUBSTRING_INDEX() and CONCAT()</title>
		<link>http://www.compiledweekly.com/2009/01/05/converting-url-to-local-file-path-in-batch-mysql-insert-query-using-substring_index-and-concat/</link>
		<comments>http://www.compiledweekly.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://www.compiledweekly.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>1</slash:comments>
		</item>
	</channel>
</rss>
