Subject Off-topic, was Re:Random multirow select, and RAND() alternative?
Author Helen Borrie
Robby,

You're off-topic in this list.

Please post support questions to the firebird-support list.

Thanks.

Helen (Moderator)

At 03:10 AM 8/07/2004 +0000, you wrote:
>Hey guys,
>
>First issue, it seems that FB 1.5.x doesn't have a RAND() function
>(??). I've read around and seen things that mention IB 5 having one
>(but it being broken). Basically I need one though...does anyone
>have a good UDF that emulates the RAND functionality? (returns a
>random number between two bounds)
>
>Secondly, I was looking into ways on _efficiently_ doing a multi-row
>select of NON-REPEATED "random" rows, for a given search criteria. I
>would like to do it all within PSQL (stored procedure). I've
>explored several options, like a stored procedure using a FOR
>SELECT ... DO construct (but that is row-by-row it seems), using
>cursors, etc. But these are mostly row-by-row random options, and
>with those, making sure a given randomly selected row isn't selected
>twice seems difficult.
>
>At this point I think the simplest way would be to do something like
>the following:
>
>SELECT DISTINCT * FROM footable WHERE ..... ORDER BY RAND()
>
>that ORDER BY RAND()/NEWID() construct works in other DBs (like MS
>SQL server, etc), but I don't know if it works in FB yet.
>
>Any ideas or guidance in this area would be welcome!
>
>Robby
>
>
>
>
>
>Community email addresses:
> Post message: Firebird-general@yahoogroups.com
> Subscribe: Firebird-general-subscribe@yahoogroups.com
> Unsubscribe: Firebird-general-unsubscribe@yahoogroups.com
> List owner: Firebird-general-owner@yahoogroups.com
>
>Shortcut URL to this page:
> http://www.yahoogroups.com/community/Firebird-general
>Yahoo! Groups Links
>
>
>
>