<?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"
	>
<channel>
	<title>Comments on: Selecting Random Records With SQL</title>
	<atom:link href="http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/</link>
	<description></description>
	<pubDate>Sat, 04 Feb 2012 12:20:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: P. F.</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11360</link>
		<dc:creator>P. F.</dc:creator>
		<pubDate>Fri, 25 Nov 2011 19:49:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11360</guid>
		<description>Thank you for your thorough explanation and use of the RAND() function.  It helped save me time and also expanded my SQL experience.</description>
		<content:encoded><![CDATA[<p>Thank you for your thorough explanation and use of the RAND() function.  It helped save me time and also expanded my SQL experience.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dallas cowboys shirts for women</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11344</link>
		<dc:creator>dallas cowboys shirts for women</dc:creator>
		<pubDate>Fri, 21 Oct 2011 09:17:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11344</guid>
		<description>Good article, Each individual point is sufficient.Appreciate your sharing with us your 

wisdom.caiyifang/comment201110</description>
		<content:encoded><![CDATA[<p>Good article, Each individual point is sufficient.Appreciate your sharing with us your </p>
<p>wisdom.caiyifang/comment201110</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ravi Parashar</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11339</link>
		<dc:creator>Ravi Parashar</dc:creator>
		<pubDate>Tue, 27 Sep 2011 07:54:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11339</guid>
		<description>Select * From Emp
Order By NewID()</description>
		<content:encoded><![CDATA[<p>Select * From Emp<br />
Order By NewID()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Il blog di Gabriele Favrin &#187; Archivio del blog &#187; Estrarre un record a caso da una tabella di un database SQL</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11337</link>
		<dc:creator>Il blog di Gabriele Favrin &#187; Archivio del blog &#187; Estrarre un record a caso da una tabella di un database SQL</dc:creator>
		<pubDate>Sun, 18 Sep 2011 21:02:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11337</guid>
		<description>[...] cosi&#8217; provato a interrogare Google e ho trovato questa magnifica pagina che insegna un trucco davvero [...]</description>
		<content:encoded><![CDATA[<p>[...] cosi&#8217; provato a interrogare Google e ho trovato questa magnifica pagina che insegna un trucco davvero [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jai@gotaninterviewcall</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11305</link>
		<dc:creator>Jai@gotaninterviewcall</dc:creator>
		<pubDate>Mon, 18 Jul 2011 06:07:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11305</guid>
		<description>Good post. It saved me lot of time.

Even the query is optimized for getting random records.</description>
		<content:encoded><![CDATA[<p>Good post. It saved me lot of time.</p>
<p>Even the query is optimized for getting random records.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: partha</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11298</link>
		<dc:creator>partha</dc:creator>
		<pubDate>Fri, 01 Jul 2011 19:14:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11298</guid>
		<description>how i can fetch record randomly from a table without rand() in Mysql??</description>
		<content:encoded><![CDATA[<p>how i can fetch record randomly from a table without rand() in Mysql??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Select random sample from SQLite table &#124; Ecostudies</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11276</link>
		<dc:creator>Select random sample from SQLite table &#124; Ecostudies</dc:creator>
		<pubDate>Sat, 16 Apr 2011 20:49:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11276</guid>
		<description>[...] A much more extended example is given by Romain (the author of QSpatialite, about which I wrote before). For examples how to do this in other databases, see this webpage. [...]</description>
		<content:encoded><![CDATA[<p>[...] A much more extended example is given by Romain (the author of QSpatialite, about which I wrote before). For examples how to do this in other databases, see this webpage. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manish Choudhary</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11274</link>
		<dc:creator>Manish Choudhary</dc:creator>
		<pubDate>Sun, 20 Mar 2011 15:58:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11274</guid>
		<description>Yups Great post, my problem has been solved by using SQL SERVER NEWID() Function.</description>
		<content:encoded><![CDATA[<p>Yups Great post, my problem has been solved by using SQL SERVER NEWID() Function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kadama</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11265</link>
		<dc:creator>Kadama</dc:creator>
		<pubDate>Sat, 06 Nov 2010 09:57:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11265</guid>
		<description>I had being seaching for these information for long time with vain. it clear, simple and it working.

Thanks</description>
		<content:encoded><![CDATA[<p>I had being seaching for these information for long time with vain. it clear, simple and it working.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL &#8211; Select Random Records From Table &#171; Eureka!</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11240</link>
		<dc:creator>SQL &#8211; Select Random Records From Table &#171; Eureka!</dc:creator>
		<pubDate>Fri, 09 Jul 2010 16:02:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11240</guid>
		<description>[...] The number of return records depends on the LIMIT value and you could find other database SQL and the tests details at CarlJ.ca &#8211; Selecting Random Records With SQL. [...]</description>
		<content:encoded><![CDATA[<p>[...] The number of return records depends on the LIMIT value and you could find other database SQL and the tests details at CarlJ.ca &#8211; Selecting Random Records With SQL. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kirk</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11206</link>
		<dc:creator>Kirk</dc:creator>
		<pubDate>Sat, 30 Jan 2010 14:29:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11206</guid>
		<description>I find it incredible that I can not find a way good way to select random records from a DB2 table by a record pointer of some type.  This would be necessary for large tables. Those in the millions of records.  Selecting by a record pointer would eliminate the need of dumping the entire table to just get a sampling.</description>
		<content:encoded><![CDATA[<p>I find it incredible that I can not find a way good way to select random records from a DB2 table by a record pointer of some type.  This would be necessary for large tables. Those in the millions of records.  Selecting by a record pointer would eliminate the need of dumping the entire table to just get a sampling.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bharat Mane</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11184</link>
		<dc:creator>Bharat Mane</dc:creator>
		<pubDate>Thu, 10 Sep 2009 06:42:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11184</guid>
		<description>This is what, I was looking for, and it saved my few hours of efforts.

Thank you so much</description>
		<content:encoded><![CDATA[<p>This is what, I was looking for, and it saved my few hours of efforts.</p>
<p>Thank you so much</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shashank</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11182</link>
		<dc:creator>shashank</dc:creator>
		<pubDate>Mon, 31 Aug 2009 14:46:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11182</guid>
		<description>good info. i NEWID() is new to me. thanks for the post. i am using the SQL is one of my projects now.</description>
		<content:encoded><![CDATA[<p>good info. i NEWID() is new to me. thanks for the post. i am using the SQL is one of my projects now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: samantha</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11181</link>
		<dc:creator>samantha</dc:creator>
		<pubDate>Fri, 07 Aug 2009 07:55:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11181</guid>
		<description>Dear all,

I have this problem in mysql database trigger.

I have two tables namely messagein and messageout.

I want to update messageout table when a message received to messagein table.
 So I wrote a database trigger in mysql.
I am using wamp-php admin,
Code as follows,

create trigger autoreply after  insert on ozekimessagein
FOR each row
begin
DECLARE tel VARCHAR(30);
SELECT @tel=sender FROM ozekimessagein ORDER BY sender DESC limit 1;
INSERT INTO ozekimessageout(receiver,msg,statuss) VALUES (@tel,'Thank you for the
message','send');
end

But when it runs give an mysql server version error.

Can you help me to resolve this matter.


Regards to all
Samantha</description>
		<content:encoded><![CDATA[<p>Dear all,</p>
<p>I have this problem in mysql database trigger.</p>
<p>I have two tables namely messagein and messageout.</p>
<p>I want to update messageout table when a message received to messagein table.<br />
 So I wrote a database trigger in mysql.<br />
I am using wamp-php admin,<br />
Code as follows,</p>
<p>create trigger autoreply after  insert on ozekimessagein<br />
FOR each row<br />
begin<br />
DECLARE tel VARCHAR(30);<br />
SELECT @tel=sender FROM ozekimessagein ORDER BY sender DESC limit 1;<br />
INSERT INTO ozekimessageout(receiver,msg,statuss) VALUES (@tel,&#8217;Thank you for the<br />
message&#8217;,&#8217;send&#8217;);<br />
end</p>
<p>But when it runs give an mysql server version error.</p>
<p>Can you help me to resolve this matter.</p>
<p>Regards to all<br />
Samantha</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carl J</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11180</link>
		<dc:creator>Carl J</dc:creator>
		<pubDate>Wed, 29 Jul 2009 11:01:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11180</guid>
		<description>Not a problem, glad I could help :)</description>
		<content:encoded><![CDATA[<p>Not a problem, glad I could help <img src='http://www.carlj.ca/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Poonam</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11178</link>
		<dc:creator>Poonam</dc:creator>
		<pubDate>Wed, 29 Jul 2009 10:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11178</guid>
		<description>Danilo Celic 

Your solution worked for me. Thanks a lot</description>
		<content:encoded><![CDATA[<p>Danilo Celic </p>
<p>Your solution worked for me. Thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carl J</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11173</link>
		<dc:creator>Carl J</dc:creator>
		<pubDate>Mon, 06 Apr 2009 13:00:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11173</guid>
		<description>Hi Gary, the problem that you're experiencing, is the same problem that I was having above. What may work (and I can't test from here right) is to change your Rnd() in the ORDER BY, and use a random number instead of the Camp_Id, which the Id never changes. Instead you could generate a random number (or use Ticks) in ASP and use that. 
"ORDER BY Rnd(Campaign.Camp_ID)" becomes "ORDER BY Rnd(" &#038; RandomASPGeneratedNumber &#038;")"
Basically, to create a random number, you need a random number</description>
		<content:encoded><![CDATA[<p>Hi Gary, the problem that you&#8217;re experiencing, is the same problem that I was having above. What may work (and I can&#8217;t test from here right) is to change your Rnd() in the ORDER BY, and use a random number instead of the Camp_Id, which the Id never changes. Instead you could generate a random number (or use Ticks) in ASP and use that.<br />
&#8220;ORDER BY Rnd(Campaign.Camp_ID)&#8221; becomes &#8220;ORDER BY Rnd(&#8221; &#038; RandomASPGeneratedNumber &#038;&#8221;)&#8221;<br />
Basically, to create a random number, you need a random number</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11172</link>
		<dc:creator>Gary</dc:creator>
		<pubDate>Mon, 06 Apr 2009 12:50:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11172</guid>
		<description>Im using access with a classic ASP front end...on MS Access the query works great:

SELECT TOP 1 Campaign.Camp_ID, Companies.AD_ID, Campaign.CampURL
FROM Companies INNER JOIN (Campaign INNER JOIN CampStats ON Campaign.Camp_ID = CampStats.CampaignID) ON Companies.AD_ID = Campaign.Co_Parent
WHERE (((Campaign.CampActive)='Yes'))
ORDER BY Rnd(Campaign.Camp_ID);

When this is ran through my ASP code, I get the same freaking ad every single time...it's the ad with the highest Camp_ID though..

thoughts?</description>
		<content:encoded><![CDATA[<p>Im using access with a classic ASP front end&#8230;on MS Access the query works great:</p>
<p>SELECT TOP 1 Campaign.Camp_ID, Companies.AD_ID, Campaign.CampURL<br />
FROM Companies INNER JOIN (Campaign INNER JOIN CampStats ON Campaign.Camp_ID = CampStats.CampaignID) ON Companies.AD_ID = Campaign.Co_Parent<br />
WHERE (((Campaign.CampActive)=&#8217;Yes&#8217;))<br />
ORDER BY Rnd(Campaign.Camp_ID);</p>
<p>When this is ran through my ASP code, I get the same freaking ad every single time&#8230;it&#8217;s the ad with the highest Camp_ID though..</p>
<p>thoughts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eduard Gamonal &#187; Blog Archive &#187; What «random» means in Microsoft</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11151</link>
		<dc:creator>Eduard Gamonal &#187; Blog Archive &#187; What «random» means in Microsoft</dc:creator>
		<pubDate>Tue, 10 Mar 2009 18:26:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11151</guid>
		<description>[...] it didn&#8217;t. I tried a few more lines, with no success. In CarlJ.ca I got an [...]</description>
		<content:encoded><![CDATA[<p>[...] it didn&#8217;t. I tried a few more lines, with no success. In CarlJ.ca I got an [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlj</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11007</link>
		<dc:creator>carlj</dc:creator>
		<pubDate>Fri, 05 Dec 2008 02:39:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11007</guid>
		<description>Hey JWhite,

Thanks for the link. I'll try it out (not that I don't believe the article) as soon as I can. I've been wanting to get around to doing an update on Access, with something similar.</description>
		<content:encoded><![CDATA[<p>Hey JWhite,</p>
<p>Thanks for the link. I&#8217;ll try it out (not that I don&#8217;t believe the article) as soon as I can. I&#8217;ve been wanting to get around to doing an update on Access, with something similar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jwhite</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11006</link>
		<dc:creator>jwhite</dc:creator>
		<pubDate>Fri, 05 Dec 2008 01:21:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-11006</guid>
		<description>For MS Access, see: http://www.databasedev.co.uk/random_query.html</description>
		<content:encoded><![CDATA[<p>For MS Access, see: <a href="http://www.databasedev.co.uk/random_query.html" rel="nofollow">http://www.databasedev.co.uk/random_query.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-10991</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Sat, 06 Sep 2008 10:22:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-10991</guid>
		<description>Awesome... thank you for this very detailed description.</description>
		<content:encoded><![CDATA[<p>Awesome&#8230; thank you for this very detailed description.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carl J &#187; This Day in History: September 2, 2008</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-10990</link>
		<dc:creator>Carl J &#187; This Day in History: September 2, 2008</dc:creator>
		<pubDate>Thu, 04 Sep 2008 23:59:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-10990</guid>
		<description>[...] Selecting Random Records with SQL [...]</description>
		<content:encoded><![CDATA[<p>[...] Selecting Random Records with SQL [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-10989</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Fri, 29 Aug 2008 08:43:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-10989</guid>
		<description>I'm considering using this for random pagination (on Postgres):

SELECT * 
FROM records
ORDER BY (recordID % 5)

In the above query 5 would either be the hour or day, so the records would be in a different order every hour or day. The drawbacks are obviously it's not frequent randomisation and if a user is paging just before the changeover of hour or day, they will probably see duplicate records.</description>
		<content:encoded><![CDATA[<p>I&#8217;m considering using this for random pagination (on Postgres):</p>
<p>SELECT *<br />
FROM records<br />
ORDER BY (recordID % 5)</p>
<p>In the above query 5 would either be the hour or day, so the records would be in a different order every hour or day. The drawbacks are obviously it&#8217;s not frequent randomisation and if a user is paging just before the changeover of hour or day, they will probably see duplicate records.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carl J</title>
		<link>http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-10986</link>
		<dc:creator>Carl J</dc:creator>
		<pubDate>Mon, 18 Aug 2008 10:27:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/#comment-10986</guid>
		<description>Hey Tim,

That would be a bit difficult to do, because everytime you ask SQL for a new page, you're asking it to select a page of random records. So whats going to stop page 2 from having some of the same records as page 1?

Now, if you want to sort the records randomly, then page through that list, then thats a different story.</description>
		<content:encoded><![CDATA[<p>Hey Tim,</p>
<p>That would be a bit difficult to do, because everytime you ask SQL for a new page, you&#8217;re asking it to select a page of random records. So whats going to stop page 2 from having some of the same records as page 1?</p>
<p>Now, if you want to sort the records randomly, then page through that list, then thats a different story.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

