Postgresql Random Rec Set - no Duplicates with Livecode
Rick Harrison
harrison at all-auctions.com
Wed Feb 2 22:06:21 EST 2011
Hi yet again Pierre,
Ok, I did a test where I used the limit of 48 out of 49 records.
It didn't pick even one duplicate. Hurray!!! The code must
advance the record counter randomly so no duplicates
occur. Nice, but unexpected.
Ok, all is well now.
Thanks again,
Rick
On Feb 2, 2011, at 9:41 PM, Rick Harrison wrote:
> Hi again Pierre,
>
> How do I avoid picking duplicates though?
>
> Rick
>
> On Feb 2, 2011, at 6:09 PM, Pierre Sahores wrote:
>
>> Hi Rick,
>>
>> SELECT *
>> FROM table
>> WHERE condition = true
>> ORDER BY hashfloat8(random())
>> LIMIT 10;
>>
>> Are you sure that the order by + limit clauses used together can't suit exactly your needs ?
>>
>> Best,
>>
>> Pierre
More information about the use-livecode
mailing list