Postgresql Random Rec Set - no Duplicates with Livecode
harrison at all-auctions.com
Wed Feb 2 20:37:54 CST 2011
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 #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!
On Feb 2, 2011, at 6:09 PM, Pierre Sahores wrote:
> SELECT *
> FROM table
> WHERE condition = true
> ORDER BY hashfloat8(random())
> LIMIT 10
More information about the use-livecode