Tmb <[EMAIL PROTECTED]> wrote: > Igor Tandetnik wrote: >> >> Try this: >> >> select name, RNDValue >> from ( >> select name, (random() / 9223372036854775807.0 + 1.0) / 2.0 as >> RNDValue from names >> ) >> where RNDValue >= 0.99; >> > > Thank you for your answer. I tried the subselect and it seems that > there is no difference to the method posted above. There are still > records with an RNDValue less than 0.99 returned as result. :-(
Yes, I tried it too and it doesn't work. Same problem: random() is called twice, and the value used in the WHERE clause is unrelated to the value reported by SELECT clause. Now, what are you trying to achieve? If the goal is to randomly select 1% of all records, it looks like you have succeeded. Do you really need the actual random value? Can't you just do select name from names where (random() / 9223372036854775807.0 + 1.0) / 2.0 >= 0.99; Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users