On Wed, 10 Mar 2004, Enver ALTIN wrote:

> Hi,
> 
> I have got a simple table like this:
> 
>         create table tips (
>               id integer primary key unique,
>               tiptext text
>         );
> 
> and, I've got a website where I'm willing to show these tips in a random
> order. Each visitor will get a randomly selected tip. So for now, I have
> to do 2 queries:
> 
>       select id from tips
> 
> collect an ID list, choose one randomly and retrieve it. I wish I could
> do something like:
> 
>       select tiptext from tips order by random limit 1

You mean like:

select * from table order by random();

That Works as far back as 7.2, maybe before.


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to