pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Long <justinlong@strategicnetwork.org>
To: pgsql-sql@hub.org
Subject: Proper syntax of WHERE (select...)?
Date: Tue, 5 Oct 1999 10:05:00 -0400
Message-ID: <006301bf0f3a$9caf09a0$95421a9f@nsmjustinlong.cbn.org> (raw)
In-Reply-To: <005501be9c7c$fde98550$bdd0be80@belvoir.army.mil>

I am attempting to generate a random select from a database. Here's
basically what I'm trying to do:

	1. select the qualified segments from a databaes
		(the query is...
			where moderator>'' and leadin>'')

	2. from this selection, select 3 random segments.

I had thought that

select id,name,leadin from country where
	oidrand(oid,3) in (select id,name,leadin from country where moderator>''
and leadin>'');

would work, but it definitely doesn't. I've been hacking around on this for
a while and can't seem to find a solution. I can get the system to select a
random number from the database, but not a random number of qualified
results.

Any suggestions from anyone?


Never retreat. Never surrender. Never cut a deal with a dragon.
_______________________________________________________________
Justin Long                   	Executive Producer
616 Station Square Ct         	http://www.strategicnetwork.org
Chesapeake, VA 23320          	Network for Strategic Missions
JustinLong@strategicnetwork.org	977 Centerville Trnpk CSB 317
757-226-5011				Va Beach, VA 23463, USA




Message-ID: <006301bf0f3a$9caf09a0$95421a9f@nsmjustinlong.cbn.org>
Permalink:  ../006301bf0f3a$9caf09a0$95421a9f@nsmjustinlong.cbn.org/
Also on:    postgresql.org/message-id/006301bf0f3a$9caf09a0$95421a9f@nsmjustinlong.cbn.org

 · 

reply

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: justinlong@strategicnetwork.org, pgsql-sql@hub.org
  Subject: Re: Proper syntax of WHERE (select...)?
  In-Reply-To: <006301bf0f3a$9caf09a0$95421a9f@nsmjustinlong.cbn.org>
  References: <005501be9c7c$fde98550$bdd0be80@belvoir.army.mil> <006301bf0f3a$9caf09a0$95421a9f@nsmjustinlong.cbn.org>

* 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