Subject Re: [firebird-support] Re: Random Records
Author Lester Caine
Ivan Prenosil wrote:

>>>The Rand() function is fixed in FB2, I think you can use it in FB1.5 too.
>>>But the above statement will always read whole table !
>>
>>The problem I have is that the 'model' provide by mysql and postgres is
>>ORDER BY RAND so just replacing with a UDF is not practical. I need to
>
> But e.g. this works "just fine", it will give random record on each execution
>
> SELECT first 1 rdb$relation_name
> FROM rdb$relations
> ORDER BY Rand();
>
> you just have to use fixed version of udf, and be aware that it does
> full table scan (as do other databases too afaik)

I need to find some time to read the Firebird release notes ;)
THE BOOK says RAND() udf does not work in FB1.5, but I had not realised
that I COULD use it with ORDER BY anyway :)
So the question now is - what do I need to do for FB1.5 to get a working
setup (please)

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
Treasurer - Firebird Foundation Inc.