On Thu, 26 Apr 2001, Jie Liang wrote:

> 
> How I can return random N rows from my select stmt?
> like:
> e.g. what my selectee is a set of 1000 rows, I want randomly
> pickup 100 of 1000.


I've donne something like:

prereg_iw=# select random(), nombre from asistente order by 1 limit 10;
        random        |    nombre     
----------------------+---------------
 0.000214523170243261 | ALFONSO
 0.000478655100091666 | OSCAR
 0.000892118085591177 | JOSE LUIS
 0.000972398091560415 | IGNACIO
  0.00109919300354048 | NORBERTO
  0.00180558208460248 | SALVADOR
  0.00196880800741204 | ANDRES NOE
  0.00197171233686233 | SARA MICHELLE
  0.00226354412839913 | DAVID
  0.00233715307076329 | RODOLFO
(10 rows)

and it works!

Saludos,

Roberto Andrade Fonseca
[EMAIL PROTECTED]


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to