<?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>Jason Fox &#187; sql</title>
	<atom:link href="http://www.jasonfox.com/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jasonfox.com</link>
	<description>programming, products, and pontifications...</description>
	<lastBuildDate>Thu, 17 Jun 2010 02:29:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rewriting Sub-selects as Joins</title>
		<link>http://www.jasonfox.com/2009/02/rewriting-sub-selects-as-joins/</link>
		<comments>http://www.jasonfox.com/2009/02/rewriting-sub-selects-as-joins/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 23:07:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.jasonfox.com/?p=68</guid>
		<description><![CDATA[Your RDBMS will usually rewrite your sub-selects behind the scenes as joins.  However, there are times where you'll want to do this yourself. Here are a couple examples of how to rewrite sub-selects as joins.]]></description>
			<content:encoded><![CDATA[<p>Your RDBMS will usually rewrite your sub-selects behind the scenes as joins.  However, there are times where you&#8217;ll want to do this yourself.  For example, past versions of MySQL did not play well with sub-selects.  Here are a couple examples of how to rewrite sub-selects as joins.</p>
<pre>select *
from   table_a
where  id not in (select a_id from table_b);
<strong>-- can be rewritten as...
</strong>select *
from   table_a
left   outer join table_b on table_a.id = table_b.a_id
where  table_b.a_id is null;

select *
from   table_a
where  id in (select a_id from table_b);
<strong>-- can be rewritten as...</strong>
select *
from   table_a
left outer join table_b on table_a.id = table_b.a_id
where  table_b.a_id is not null;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonfox.com/2009/02/rewriting-sub-selects-as-joins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
