From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Christoph Pingel <ch(dot)pingel(at)web(dot)de> |
Cc: | postgresql-general mailing list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: no self-joins in views? |
Date: | 2005-02-10 17:00:22 |
Message-ID: | 20050210170022.GA71525@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Feb 10, 2005 at 05:13:51PM +0100, Christoph Pingel wrote:
>
> is there any restriction re the use of self joins in views? I have a
> moderately complicated query where I scan the same table twice using
> aliases, and I would like to put that into a view to keep my python
> code clean. However, I get an error 'column xy duplicated'. Is this
> so by design?
Use column aliases so the xy columns don't have the same name:
CREATE VIEW viewname AS
SELECT a.xy AS axy,
b.xy AS bxy
FROM foo AS a,
foo AS b
WHERE ...
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
From | Date | Subject | |
---|---|---|---|
Next Message | Christoph Pingel | 2005-02-10 17:20:50 | Re: no self-joins in views? |
Previous Message | Martijn van Oosterhout | 2005-02-10 16:54:20 | Re: no self-joins in views? |