From: Joao Pedro M. F. Monoo <jpedro@infortrade.com.br>
To: pgsql-sql@postgresql.org
Subject: Re: random rows
Date: Thu, 26 Apr 2001 16:18:49 -0300
Message-ID: <001701c0ce85$b988dae0$06ffa8c0@infortrade.com.br> (raw)
References: <Pine.BSF.4.10.10104261133340.77756-100000@tidal.ipinc.com>
Hi!
> 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.
use the LIMIT clause
example
SELECT * FROM test_table LIMIT 100;
you can also use the OFFSET clause to skip to n row and the fetch the n
desired rows
example
SELECT * FROM test_table LIMIT 100 OFFSET 100;
this will skip to row number 100 and the fetch the next 100 rows
[]´s
---------------------------------------------
Joao Pedro M. F. Monoo
Infortrade Information Systems
#183816 Linux Registered User
Slackware 7.1 running 2.4.2 Linux Kernel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jpedro@infortrade.com.br
Subject: Re: random rows
In-Reply-To: <001701c0ce85$b988dae0$06ffa8c0@infortrade.com.br>
References: <Pine.BSF.4.10.10104261133340.77756-100000@tidal.ipinc.com> <001701c0ce85$b988dae0$06ffa8c0@infortrade.com.br>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox