strange result for select * from table where id=random()*900

From: Stefan Zweig <stefanzweig1881(at)web(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: strange result for select * from table where id=random()*900
Date: 2007-07-27 07:48:41
Message-ID: 156384696@web.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

hi list,

this is my query:

select
*
from _g2977
where
id=floor(random() * (900));

in table _g2977 i have id(s) from 1 up to 900. i just want to select one random dataset by the above query but i does not work.

actually i get sometime zero, sometimes one, sometimes two and sometimes even three results back from the above query although i thought it should give only one random dataset from the table.

what is wrong?

i appreciate any help.

thanks in advance, stefan
_________________________________________________________________________
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten!
Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tommy Gildseth 2007-07-27 07:56:20 Re: strange result for select * from table where id=random()*900
Previous Message Dmitry Turin 2007-07-27 06:40:13 Re: calling webservice through postgresql function