Postgresql Random Rec Set - no Duplicates with Livecode

Pierre Sahores psahores at free.fr
Thu Feb 3 00:51:54 CST 2011


You welcome, Rick.

PS: PostgreSQL, the amazing diamond of the ACID-SQL db world ;-)

Best,

Pierre

Le 3 févr. 2011 à 03:37, Rick Harrison a écrit :

> Hi Pierre,
> 
> I tried "ORDER BY random() LIMIT 21"
> 
> It does work the way I want it to.  
> 
> It was just the way they described it work, that 
> didn't sound correct.  It sounded like the code 
> would just select the first 21 records which
> met my 'true' requirement in the database and 
> then reorder them randomly. (Not what I wanted.)
> 
> I made up a test where I assigned my own
> record values from 1-49 and then used
> the above code.  My results were:
> 
> record #41
> record #3
> record #24 ...
> 
> for a total of 21 records.
> So everything does seem to work correctly.
> 
> What does hashfloat8 do for one?
> 
> Thanks, all is well again!
> 
> Rick
> 
> On Feb 2, 2011, at 6:09 PM, Pierre Sahores wrote:
> 
>> SELECT *
>> FROM table
>> WHERE condition = true
>> ORDER BY hashfloat8(random())
>> LIMIT 10
> 
> 
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 

--
Pierre Sahores
mobile : (33) 6 03 95 77 70

www.woooooooords.com
www.sahores-conseil.com







More information about the use-livecode mailing list