Your problem, I _think_, is that your query works as follows:

for i = 0 to table_name.rows {
        row <-- table_name.row[i]
        if row.count = ROUND(rand() * 100000) then result += row
}

NOTE:  ROUND(rand() * 100000) is performed FOR EACH ROW in your table.  You 
actually mean for it to be performed once and that specific row be returned.

The solution, then, is to have a constant in your WHERE clause.  Or at least, 
determine its value outside of the select statement.

On Friday 15 March 2002 9:23 am, [EMAIL PROTECTED] wrote:
> I have database with table and 1 milions random characters. Key for
> searching each character is a counter from 1 to milion.
>
> when I execute statement:
>
> SELECT count, character FROM table_name WHERE count=ROUND(rand()*100000);
>
> Example:
>
> count ||      character ||
>
> 1             dasarewr
> 2             adswarwrf
> 3             sfdqwerw
> 4             dfweqrqwe
> 5             asdfwerdfwe
> 6             fdwerwer
> 7             fsdwefwe
> 8             frefer
> ...           .....
>
> 9999          daswer
> 1000          fdferte
> ....          .....
>
>
> 999999                asdwerer
> 1000000               dasrewg
>
> RESULT:
>
> 1) Sometimes I get just one result like:
> 4352342               dcfsfwer
>
> 2)Sometimes I get TWO results!
>
> 1000            fdferte
> 999999          asdwerer
>
> 3) sometimes even THREE
> ....
>
>
> 4) sometimes NONE
>
>
> The select statement must to gave me just ONE result!
>
> Does anyone know what that is about? Does ROUND() have any bugs?
>
> Sorry for bad english.
>
> Elvir
>
>
> ---end of your message-------
>
> MySQL Development Team
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]> Trouble
> unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to