<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.5" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Select bottom rows</title>
	<link>http://laurentschneider.com/wordpress/2008/05/select-bottom-rows.html</link>
	<description>Oracle Certified Master</description>
	<pubDate>Sun, 07 Sep 2008 13:04:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.5</generator>

	<item>
		<title>by: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2008/05/select-bottom-rows.html#comment-6514</link>
		<pubDate>Thu, 01 May 2008 14:13:33 +0000</pubDate>
		<guid>http://laurentschneider.com/wordpress/2008/05/select-bottom-rows.html#comment-6514</guid>
					<description>of course you are right, thanks for your feedback. The "user" thing was supposed to be a business justification :mrgreen:

glad you tried with WITH :)</description>
		<content:encoded><![CDATA[<p>of course you are right, thanks for your feedback. The &#8220;user&#8221; thing was supposed to be a business justification  <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_mrgreen.gif' alt=':mrgreen:' class='wp-smiley' /> </p>
<p>glad you tried with WITH <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Brian Tkatch</title>
		<link>http://laurentschneider.com/wordpress/2008/05/select-bottom-rows.html#comment-6511</link>
		<pubDate>Thu, 01 May 2008 12:29:44 +0000</pubDate>
		<guid>http://laurentschneider.com/wordpress/2008/05/select-bottom-rows.html#comment-6511</guid>
					<description>Laurent, i find SELECTing by Rownum and ORDERing BY it in the same statement, to be confusing. Probably just a familiarity thing.

I tried you example in a slightly different way. The user thing was too much effort! :P

&lt;code&gt;
WITH
	Moo
AS
	(
	 SELECT 5 A, 0 B FROM Dual UNION ALL
	 SELECT 6 A, 1 B FROM Dual UNION ALL
	 SELECT 4 A, 2 B FROM Dual UNION ALL
	 SELECT 7 A, 3 B FROM Dual UNION ALL
	 SELECT 3 A, 4 B FROM Dual UNION ALL
	 SELECT 8 A, 5 B FROM Dual UNION ALL
	 SELECT 2 A, 6 B FROM Dual UNION ALL
	 SELECT 9 A, 7 B FROM Dual UNION ALL
	 SELECT 1 A, 8 B FROM Dual UNION ALL
	 SELECT 0 A, 9 B FROM Dual
	),
	Cow
AS
	(
	 SELECT
		A
	 FROM
		Moo
	 ORDER BY
		B
	)
SELECT
	R,
	A
FROM
	(
	 SELECT
		RowNum R,
		A
	 FROM
		Cow
	 ORDER BY
		Rownum DESC
	)
WHERE
	Rownum&lt; 4
ORDER BY
	R;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Laurent, i find SELECTing by Rownum and ORDERing BY it in the same statement, to be confusing. Probably just a familiarity thing.</p>
<p>I tried you example in a slightly different way. The user thing was too much effort! <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p><pre><code>
WITH
&nbsp;&nbsp;Moo
AS
&nbsp;&nbsp;(
&nbsp;&nbsp; SELECT 5 A, 0 B FROM Dual UNION ALL
&nbsp;&nbsp; SELECT 6 A, 1 B FROM Dual UNION ALL
&nbsp;&nbsp; SELECT 4 A, 2 B FROM Dual UNION ALL
&nbsp;&nbsp; SELECT 7 A, 3 B FROM Dual UNION ALL
&nbsp;&nbsp; SELECT 3 A, 4 B FROM Dual UNION ALL
&nbsp;&nbsp; SELECT 8 A, 5 B FROM Dual UNION ALL
&nbsp;&nbsp; SELECT 2 A, 6 B FROM Dual UNION ALL
&nbsp;&nbsp; SELECT 9 A, 7 B FROM Dual UNION ALL
&nbsp;&nbsp; SELECT 1 A, 8 B FROM Dual UNION ALL
&nbsp;&nbsp; SELECT 0 A, 9 B FROM Dual
&nbsp;&nbsp;),
&nbsp;&nbsp;Cow
AS
&nbsp;&nbsp;(
&nbsp;&nbsp; SELECT
&nbsp;&nbsp;&nbsp;&nbsp;A
&nbsp;&nbsp; FROM
&nbsp;&nbsp;&nbsp;&nbsp;Moo
&nbsp;&nbsp; ORDER BY
&nbsp;&nbsp;&nbsp;&nbsp;B
&nbsp;&nbsp;)
SELECT
&nbsp;&nbsp;R,
&nbsp;&nbsp;A
FROM
&nbsp;&nbsp;(
&nbsp;&nbsp; SELECT
&nbsp;&nbsp;&nbsp;&nbsp;RowNum R,
&nbsp;&nbsp;&nbsp;&nbsp;A
&nbsp;&nbsp; FROM
&nbsp;&nbsp;&nbsp;&nbsp;Cow
&nbsp;&nbsp; ORDER BY
&nbsp;&nbsp;&nbsp;&nbsp;Rownum DESC
&nbsp;&nbsp;)
WHERE
&nbsp;&nbsp;Rownum&lt; 4
ORDER BY
&nbsp;&nbsp;R;</code></pre>
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
