<?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: Select Last 100&#160;Records</title>
	<atom:link href="http://particletree.com/notebook/select-last-100-records/feed/" rel="self" type="application/rss+xml" />
	<link>http://particletree.com/notebook/select-last-100-records/</link>
	<description>Everyone needs a hug.</description>
	<lastBuildDate>Mon, 16 Nov 2009 21:43:07 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Murtaza</title>
		<link>http://particletree.com/notebook/select-last-100-records/comment-page-1/#comment-20864</link>
		<dc:creator>Murtaza</dc:creator>
		<pubDate>Sat, 19 May 2007 00:24:54 +0000</pubDate>
		<guid isPermaLink="false">http://particletree.com/notebook/select-last-100-records/#comment-20864</guid>
		<description>&lt;p&gt;I agree with Ryan, Its better to keep your code clean and easier to understand and let Sql do the job when it can do it easily and efficiently and without creating a mess on application logic&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I agree with Ryan, Its better to keep your code clean and easier to understand and let Sql do the job when it can do it easily and efficiently and without creating a mess on application logic</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Different Kevin</title>
		<link>http://particletree.com/notebook/select-last-100-records/comment-page-1/#comment-20505</link>
		<dc:creator>Different Kevin</dc:creator>
		<pubDate>Wed, 04 Apr 2007 16:58:44 +0000</pubDate>
		<guid isPermaLink="false">http://particletree.com/notebook/select-last-100-records/#comment-20505</guid>
		<description>&lt;p&gt;Him=Jim :D&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Him=Jim :D</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Different Kevin</title>
		<link>http://particletree.com/notebook/select-last-100-records/comment-page-1/#comment-20504</link>
		<dc:creator>Different Kevin</dc:creator>
		<pubDate>Wed, 04 Apr 2007 16:58:19 +0000</pubDate>
		<guid isPermaLink="false">http://particletree.com/notebook/select-last-100-records/#comment-20504</guid>
		<description>&lt;p&gt;Agree completely with Him&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Agree completely with Him</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://particletree.com/notebook/select-last-100-records/comment-page-1/#comment-20356</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Wed, 21 Mar 2007 14:25:25 +0000</pubDate>
		<guid isPermaLink="false">http://particletree.com/notebook/select-last-100-records/#comment-20356</guid>
		<description>&lt;p&gt;I agree with Mark.  Have created and modified fields (as needed).  You are using the pk for ordering the records here, and imho that is a misuse of the PK.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I agree with Mark.  Have created and modified fields (as needed).  You are using the pk for ordering the records here, and imho that is a misuse of the PK.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Jim</title>
		<link>http://particletree.com/notebook/select-last-100-records/comment-page-1/#comment-20318</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Wed, 14 Mar 2007 19:47:15 +0000</pubDate>
		<guid isPermaLink="false">http://particletree.com/notebook/select-last-100-records/#comment-20318</guid>
		<description>&lt;p&gt;Off topic:  Is it just me, or does anyone else find this comment layout hard to follow?  Do I follow it from the left down, and then rightside down?  Or do I alternate from the left to the right?  Or is it some other way?&lt;/p&gt;

&lt;p&gt;Very confusing.  Not a design decision I would have expected from this kind of site.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Off topic:  Is it just me, or does anyone else find this comment layout hard to follow?  Do I follow it from the left down, and then rightside down?  Or do I alternate from the left to the right?  Or is it some other way?</p>

<p>Very confusing.  Not a design decision I would have expected from this kind of site.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Campbell</title>
		<link>http://particletree.com/notebook/select-last-100-records/comment-page-1/#comment-20279</link>
		<dc:creator>Ryan Campbell</dc:creator>
		<pubDate>Wed, 07 Mar 2007 14:42:59 +0000</pubDate>
		<guid isPermaLink="false">http://particletree.com/notebook/select-last-100-records/#comment-20279</guid>
		<description>&lt;p&gt;I can see everyones reasoning for a reversal of the array is no big deal, but in a perfect world wouldn&#039;t we still have it in the query? For example, let&#039;s say we have a function that loops through an array and makes an ordered list. Then we have a function that takes an SQL query and hits the DB and loads the given array.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function loadData($sql) {
    $data = queryDb($sql);
    drawList($data);
}

function drawList($data) {
    // loop through array and make list
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In order to make those function generic, a second parameter would have to be added to &lt;code&gt;loadData&lt;/code&gt; to determine if a reversal should be done. Wouldn&#039;t this be easier if it was all handled in the SQL? Maybe I&#039;m misunderstanding something ... correct me if I&#039;m wrong.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I can see everyones reasoning for a reversal of the array is no big deal, but in a perfect world wouldn&#8217;t we still have it in the query? For example, let&#8217;s say we have a function that loops through an array and makes an ordered list. Then we have a function that takes an SQL query and hits the DB and loads the given array.</p>

<pre><code>function loadData($sql) {
    $data = queryDb($sql);
    drawList($data);
}

function drawList($data) {
    // loop through array and make list
}
</code></pre>

<p>In order to make those function generic, a second parameter would have to be added to <code>loadData</code> to determine if a reversal should be done. Wouldn&#8217;t this be easier if it was all handled in the SQL? Maybe I&#8217;m misunderstanding something &#8230; correct me if I&#8217;m wrong.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Mislav</title>
		<link>http://particletree.com/notebook/select-last-100-records/comment-page-1/#comment-20276</link>
		<dc:creator>Mislav</dc:creator>
		<pubDate>Wed, 07 Mar 2007 04:21:46 +0000</pubDate>
		<guid isPermaLink="false">http://particletree.com/notebook/select-last-100-records/#comment-20276</guid>
		<description>&lt;p&gt;Seems like I also didn&#039;t read all the comments at first.&lt;/p&gt;

&lt;p&gt;Ryan, your reasoning is ... strange. If you&#039;re building an API on top of SQL, but refuse to have application logic in it and try to keep everything in the database, then we&#039;re not talking about 3-tiered design. So if you&#039;re building an API that is in fact pure SQL, then let SQL be your API.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Seems like I also didn&#8217;t read all the comments at first.</p>

<p>Ryan, your reasoning is &#8230; strange. If you&#8217;re building an API on top of SQL, but refuse to have application logic in it and try to keep everything in the database, then we&#8217;re not talking about 3-tiered design. So if you&#8217;re building an API that is in fact pure SQL, then let SQL be your API.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Mislav</title>
		<link>http://particletree.com/notebook/select-last-100-records/comment-page-1/#comment-20275</link>
		<dc:creator>Mislav</dc:creator>
		<pubDate>Wed, 07 Mar 2007 04:14:10 +0000</pubDate>
		<guid isPermaLink="false">http://particletree.com/notebook/select-last-100-records/#comment-20275</guid>
		<description>&lt;p&gt;This is insane. You had it in the first query, just make a reverse loop in the app.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This is insane. You had it in the first query, just make a reverse loop in the app.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://particletree.com/notebook/select-last-100-records/comment-page-1/#comment-20272</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Tue, 06 Mar 2007 19:37:15 +0000</pubDate>
		<guid isPermaLink="false">http://particletree.com/notebook/select-last-100-records/#comment-20272</guid>
		<description>&lt;p&gt;Hi Ryan,&lt;/p&gt;

&lt;p&gt;Why is the root cause of the specification that the data &lt;em&gt;must&lt;/em&gt; be in ascending order?  What if the end user wanted to display in descending order?  If you provide an API, why not 2 methods: getLastUpdatedDesc() and getLastUpdatedAsc() where the latter uses the former to deliver the results?  Then your original query is the most optimal.&lt;/p&gt;

&lt;p&gt;If you want to embed the logic at the highest level, a view or stored procedure would be your best bet, but this eliminates Mysql &lt; 5.  There really isn&#039;t a difference between code and SQL if both are used at the same tier.&lt;/p&gt;

&lt;p&gt;Kevin&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Ryan,</p>

<p>Why is the root cause of the specification that the data <em>must</em> be in ascending order?  What if the end user wanted to display in descending order?  If you provide an API, why not 2 methods: getLastUpdatedDesc() and getLastUpdatedAsc() where the latter uses the former to deliver the results?  Then your original query is the most optimal.</p>

<p>If you want to embed the logic at the highest level, a view or stored procedure would be your best bet, but this eliminates Mysql &lt; 5.  There really isn&#8217;t a difference between code and SQL if both are used at the same tier.</p>

<p>Kevin</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Lars</title>
		<link>http://particletree.com/notebook/select-last-100-records/comment-page-1/#comment-20268</link>
		<dc:creator>Lars</dc:creator>
		<pubDate>Tue, 06 Mar 2007 13:20:48 +0000</pubDate>
		<guid isPermaLink="false">http://particletree.com/notebook/select-last-100-records/#comment-20268</guid>
		<description>&lt;p&gt;Oops, should&#039;ve refreshed before posting my comment, you posted your reasons for wanting to keep the ordering logic in SQL, while I was reading and formulating an answer. Nevermind...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Oops, should&#8217;ve refreshed before posting my comment, you posted your reasons for wanting to keep the ordering logic in SQL, while I was reading and formulating an answer. Nevermind&#8230;</p>]]></content:encoded>
	</item>
</channel>
</rss>
