From: Howard Smith <hsmith@visualmining.com>
To: pgsql-sql@postgresql.org
Subject: UNION and LIMIT issue
Date: Thu, 19 Jul 2007 18:00:55 -0400
Message-ID: <469FDF17.9060701@visualmining.com> (raw)
in pgsql 8.2 using LIMIT with UNION is throwing errors...
table is
-------------------------------
name quantity
character varying integer
-------------------------------
Banana 10
Cherry 10
Apple 5
Persimmon 3
Mango 2
the query :
SELECT name,quantity FROM fruit limit 3
UNION
select name,CAST(SUM(quantity) as integer) from (
select Cast('Other' as varchar) as name,quantity from fruit
limit ALL offset 3
) w group by name
throws an error on the UNION. Removing the first 'Limit 3' fixes the query,
but i need the limit statement. Anybody seen this behavior?
--
Howard Smith
professional services engineer
Visual Mining Inc
15825 Shady Grove Road, Suite 20
Rockville, MD 20850
tel 301.795.2239 fax 301.947.8293
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: hsmith@visualmining.com
Subject: Re: UNION and LIMIT issue
In-Reply-To: <469FDF17.9060701@visualmining.com>
* 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