Postgresql Random Rec Set - no Duplicates with Livecode
psahores at free.fr
Wed Feb 2 18:09:16 EST 2011
WHERE condition = true
ORDER BY hashfloat8(random())
Are you sure that the order by + limit clauses used together can't suit exactly your needs ?
Le 2 févr. 2011 à 23:40, Rick Harrison a écrit :
> Hi Pierre,
> What I'm looking to do is to perform the Random pick from the database,
> not reorder my results randomly after I've gotten all records. I don't think
> the code links below help me to do that. I've been down this road already.
> Thanks anyways!
> On Feb 2, 2011, at 4:29 PM, Pierre Sahores wrote:
>> It's a SQL syntax task, not a revDB one and as soon as the query will be OK, revDB will just handle it as expected.
>> Best regards,
>> Le 2 févr. 2011 à 21:29, Rick Harrison a écrit :
>>> Hi there,
>>> I need to know the best way to get a random subset
>>> of records without duplicates in the resulting record
>>> set using a Postgresql database query with Livecode
>>> on On-Rev.
>>> In other words, I don't want to have to get all of the
>>> records in the database first just to be able to pick
>>> out the 21 random records i need, as that seems rather
>>> inefficient. Assume a couple of thousand records
>>> in the database or more.
>>> Thanks for your ideas in advance!
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> Pierre Sahores
>> mobile : (33) 6 03 95 77 70
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> Rick Harrison
> You can buy my $10 music album "Funny Time Machine" digital CD on the iTunes Store Now!
> To visit the iTunes Store now to listen to samples of my CD please click on the
> following link. (Please note you must have iTunes installed on your computer for this link to work.)
> 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