<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Makes for some ugly SQL, but&#8230;</title>
	<link>http://ambethia.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fambethia.com%2F2008%2F06%2F19%2Fmakes-for-some-ugly-sql-but%2F&amp;seed_title=Makes+for+some+ugly+SQL%2C+but%26%238230%3B</link>
	<description>The journal and personal website of Jason L Perry</description>
	<pubDate>Fri, 21 Nov 2008 16:26:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Jason Perry</title>
		<link>http://ambethia.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fambethia.com%2F2008%2F06%2F19%2Fmakes-for-some-ugly-sql-but%2F&amp;seed_title=Makes+for+some+ugly+SQL%2C+but%26%238230%3B#comment-3275</link>
		<dc:creator>Jason Perry</dc:creator>
		<pubDate>Thu, 19 Jun 2008 15:55:42 +0000</pubDate>
		<guid>http://ambethia.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fambethia.com%2F2008%2F06%2F19%2Fmakes-for-some-ugly-sql-but%2F&amp;seed_title=Makes+for+some+ugly+SQL%2C+but%26%238230%3B#comment-3275</guid>
		<description>&lt;code lang="ruby"&gt;
Book.find(2).listings
&lt;/code&gt;

&lt;code lang="sql"&gt;
SELECT * FROM `books` WHERE (`books`.`id` = 2) 
SELECT * FROM `listings` WHERE (`listings`.book_id = 2) 
&lt;/code&gt;

As many selects from the `guides` table as there are listings.

&lt;code lang="ruby"&gt;
Book.find(2).listings.sort
&lt;/code&gt;

&lt;code lang="sql"&gt;
SELECT * FROM `books` WHERE (`books`.`id` = 2) 
SELECT * FROM `listings` WHERE (`listings`.book_id = 2) 
SELECT * FROM `guides` WHERE (`guides`.`id` = 8) 
SELECT * FROM `guides` WHERE (`guides`.`id` = 2) 
SELECT * FROM `guides` WHERE (`guides`.`id` = 4) 
SELECT * FROM `guides` WHERE (`guides`.`id` = 1) 
SELECT * FROM `guides` WHERE (`guides`.`id` = 7) 
SELECT * FROM `guides` WHERE (`guides`.`id` = 5)
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<div class="code ruby" style="font-family: monospace;">
Book.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">listings</span></p>
<p>&nbsp;</p></div>
<div class="code sql" style="font-family: monospace;">
<span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`books`</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`books`</span>.<span style="color: #ff0000;">`id`</span> = <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> <br />
<span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`listings`</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`listings`</span>.book_id = <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> </p>
<p>&nbsp;</p></div>
<p>As many selects from the `guides` table as there are listings.</p>
<div class="code ruby" style="font-family: monospace;">
Book.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">listings</span>.<span style="color:#9900CC;">sort</span></p>
<p>&nbsp;</p></div>
<div class="code sql" style="font-family: monospace;">
<span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`books`</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`books`</span>.<span style="color: #ff0000;">`id`</span> = <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> <br />
<span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`listings`</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`listings`</span>.book_id = <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> <br />
<span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`guides`</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`guides`</span>.<span style="color: #ff0000;">`id`</span> = <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span> <br />
<span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`guides`</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`guides`</span>.<span style="color: #ff0000;">`id`</span> = <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> <br />
<span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`guides`</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`guides`</span>.<span style="color: #ff0000;">`id`</span> = <span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span> <br />
<span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`guides`</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`guides`</span>.<span style="color: #ff0000;">`id`</span> = <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <br />
<span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`guides`</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`guides`</span>.<span style="color: #ff0000;">`id`</span> = <span style="color: #cc66cc;">7</span><span style="color: #66cc66;">&#41;</span> <br />
<span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`guides`</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`guides`</span>.<span style="color: #ff0000;">`id`</span> = <span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span></p>
<p>&nbsp;</p></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pope</title>
		<link>http://ambethia.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fambethia.com%2F2008%2F06%2F19%2Fmakes-for-some-ugly-sql-but%2F&amp;seed_title=Makes+for+some+ugly+SQL%2C+but%26%238230%3B#comment-3274</link>
		<dc:creator>Pope</dc:creator>
		<pubDate>Thu, 19 Jun 2008 15:13:21 +0000</pubDate>
		<guid>http://ambethia.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fambethia.com%2F2008%2F06%2F19%2Fmakes-for-some-ugly-sql-but%2F&amp;seed_title=Makes+for+some+ugly+SQL%2C+but%26%238230%3B#comment-3274</guid>
		<description>Ahhh...but what does the SQL look like?</description>
		<content:encoded><![CDATA[<p>Ahhh&#8230;but what does the <span class="caps">SQL</span> look like?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
