Reply to Re: SELECT a random 10 records from table....easy newbie question

Your name:

Reply:


Posted by Sψren Reinke on 08/17/07 06:12

Hugo Kornelis wrote:
> On Thu, 16 Aug 2007 03:39:49 -0700, WhytheQ wrote:
>
>> This doesn't work:
>>
>> --****************************************
>> USE myDatabase
>> SELECT TOP 10 *
>>FROM myTable
>> WHERE NEWID()
>> --****************************************
>>
>> ..I know I need to use the function newID() to find random records -
>> just don't know where it fits in the query (suspect the TOP will need
>> to go from the above)
>>
>> Any help greatly appreciated
>> J
>
> Hi J,
>
> Marcin's answer is correct. However, if you're on SQL Server 2005 you
> can also use the new TABLESAMPLE option (see Books Online for the
> details); this will probably perform better on large tables.

Do you have a link to the book you are talking about ?

p.s. You blog is to large for pageflakes :( (max 512000 bytes) could you
maybe cut down the articles in the feed ?

Best regards
SΓΈren

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация