From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Jelle Ouwerkerk <jelle(at)openface(dot)ca>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: random |
Date: | 2001-03-05 21:04:35 |
Message-ID: | 200103052104.QAA01988@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> Jelle Ouwerkerk <jelle(at)openface(dot)ca> writes:
> > Also, is there a way to randomize the order of a result set?
>
> There's always
> SELECT * FROM foo ORDER BY random();
>
How does that work?
test=> select random();
random
-------------------
0.896045367650709
(1 row)
However:
test=> select * from pg_class order by random();
does return some output. Is it random, and if so, how?
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-03-05 21:05:31 | Re: [SQL] PL/SQL-to-PL/PgSQL-HOWTO beta Available |
Previous Message | Justin Long | 2001-03-05 20:56:26 | Optimizing Query |