Proper syntax of WHERE (select...)?

From: "Justin Long" <justinlong(at)strategicnetwork(dot)org>
To: <pgsql-sql(at)hub(dot)org>
Subject: Proper syntax of WHERE (select...)?
Date: 1999-10-05 14:05:00
Message-ID: 006301bf0f3a$9caf09a0$95421a9f@nsmjustinlong.cbn.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)strategicnetwork(dot)org 977 Centerville Trnpk CSB 317
757-226-5011 Va Beach, VA 23463, USA

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-10-05 14:34:47 Re: [SQL] 2 Aktions in a Rule
Previous Message Sergey Bondarenko 1999-10-05 10:31:04 RE: [SQL] 2 Aktions in a Rule