Postgresql Random Rec Set - no Duplicates with Livecode
psahores at free.fr
Thu Feb 3 02:17:22 EST 2011
To avoid possible border effects, did you try how it goes in adding the distinct clause alike this :
SELECT DISTINCT *
WHERE condition = true
ORDER BY hashfloat8(random())
Le 3 févr. 2011 à 04:06, Rick Harrison a écrit :
> 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,
> On Feb 2, 2011, at 9:41 PM, Rick Harrison wrote:
>> Hi again Pierre,
>> How do I avoid picking duplicates though?
>> 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 ?
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
mobile : (33) 6 03 95 77 70
More information about the Use-livecode