Limit doesn't work with select unions

From: Postgres <postgres(at)weblynk(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgreSQL(dot)org>
Subject: Limit doesn't work with select unions
Date: 1999-10-25 08:27:40
Message-ID: 071a01bf1ec2$ce0cd760$9befaace@usedcars.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-sql

I'm doing the following query:
select a.id, cfs.id from cfs where a.id = cfs.oid union select b.id, cfs.id
from cfs where b.id = cfs.oid limit 1;
The limit basically doesn't work. I get the maximum amount of rows back.
I try the query
select a.id, cfs.id from cfs where a.id = cfs.oid limit 1 union select b.id,
cfs.id from cfs where b.id = cfs.oid limit 1;
and psql says the syntax is incorrect. Any ideas on how to use limit with
union queries?
Thanks,
Rich

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Oleg Bartunov 1999-10-25 09:02:50 Re: [SQL] Limit doesn't work with select unions
Previous Message System Administrator 1999-10-25 02:11:34 Errors in Postgres

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 1999-10-25 08:52:34 Re: [SQL] possible bug?
Previous Message Dipankar Chakrabarti 1999-10-25 05:31:56 pg_dump for PGPLSQL