Skip site navigation (1) Skip section navigation (2)

7.1 feature?

From: Kaare Rasmussen <kar(at)webline(dot)dk>
To: PostgreSQL-SQL <pgsql-sql(at)postgresql(dot)org>
Subject: 7.1 feature?
Date: 2000-12-28 15:44:19
Message-ID: 00122816441901.00780@bering (view raw or flat)
Thread:
Lists: pgsql-sql
I need to do something like this:

SELECT n.name FROM 
(SELECT p.contact_seq AS contact_seq, p.lastname||', '||p.firstname AS name 
FROM person p
UNION 
 SELECT co.name AS name FROM company co) n;

Of course there's more; this is cut from the original select.
But PostgreSQL complains about SELECT (i guess it's the SELECT in the 
subquery)
In the dox I read:

A FROM item can also be a parenthesized sub-SELECT (note that an alias clause 
is required for a sub-SELECT!). This is an extremely handy feature since it's 
the only way to get multiple levels of grouping, aggregation, or sorting in a 
single query. 

Is this a 7.1 feature? Or is my typing wrong?
And will 7.1 support unions in subselects like above?

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 14.00-18.00        Email: kar(at)webline(dot)dk
2000 Frederiksberg        Lørdag 11.00-17.00       Web:      www.suse.dk

Responses

pgsql-sql by date

Next:From: Tom LaneDate: 2000-12-28 16:18:36
Subject: Re: 7.1 feature?
Previous:From: Ron PetersonDate: 2000-12-28 15:12:56
Subject: Re: How to represent a tree-structure in a relational database

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group