Thread: Re: CREATE VIEW ERROR

Re: CREATE VIEW ERROR

From
"Igor"
Date:
I found answer.
Thank you for everyone who did not reply.


CREATE VIEW depend_view AS
SELECT depend.subfunction_id, a.subfunction_file AS x,
depend.subfunction_dep_id, b.subfunction_file AS y
FROM depend INNER JOIN subfunction a ON depend.subfunction_id =
a.subfunction_id INNER JOIN subfunction b ON depend.subfunction_dep_id =
b.subfunction_id;



"Igor" <kryltsov@yahoo.com> wrote in message
news:d418ccf3.0301181703.57244c80@posting.google.com...
> Hi,
>
> I have following SQL statement which does not report any errors:
>
> test=# SELECT a.subfunction_file, b.subfunction_file
> test-# FROM depend INNER JOIN subfunction a ON depend.subfunction_id =
> a.subfunction_id
> test-# INNER JOIN subfunction b ON depend.subfunction_dep_id =
> b.subfunction_id;
>       subfunction_file      |      subfunction_file
> ----------------------------+----------------------------
>  show_batch_2.php           | search_receipt.php
> ...........
>
> But when I try to create VIEW a have following error:
>
> test=# create view depend_view as SELECT a.subfunction_file,
> b.subfunction_file
> test-# FROM depend INNER JOIN subfunction a ON depend.subfunction_id =
> a.subfunction_id
> test-# INNER JOIN subfunction b ON depend.subfunction_dep_id =
> b.subfunction_id;
>
> ERROR:  CREATE TABLE: attribute "subfunction_file" duplicated
> <<<--------!!!!
>
>
> Please advise where is my mistake. I use:
>
> test=# select version();
>                                version
> ---------------------------------------------------------------------
>  PostgreSQL 7.2.1 on i386-unknown-freebsd4.3, compiled by GCC 2.95.3
> (1 row)
>
>
> Thank you,
>
> Igor