Re: stupid SQL question, how reach different rows of two almost same tables - Mailing list pgsql-novice

From Jaromír Kamler
Subject Re: stupid SQL question, how reach different rows of two almost same tables
Date
Msg-id 200510061253.25931@centrum.cz
Whole thread Raw
In response to stupid SQL question, how reach different rows of two almost same tables  (" Jaromír Kamler" <kamler@centrum.cz>)
Responses Re: stupid SQL question, how reach different rows of two almost same tables  (Michael Fuhr <mike@fuhr.org>)
List pgsql-novice
Thanks for your reply, I tryed it and modified it for my needs, but this is result:

--error message
SQL error:

ERROR:  subquery in FROM must have an alias
HINT:  For example, FROM (SELECT ...) [AS] foo.

In statement:
create temp table t1 as
select * from (select f_table_name from geometry_columns intersect select jmeno from tables) as tmp_foo;

select * from (select f_table_name from geometry_columns except select jmeno from tables)) as tmp_foo1
union
select * from (select jmeno from tables except select f_table_name from geomety_columns) as tmp_foo2;

I was traying somethin like this, but it looks like wrong way:
SELECT f_table_name FROM geometry_columns WHERE (SELECT jmeno FROM tables) NOT IN (SELECT f_table_name FROM
geometry_columns);


Thank you for your help
Jaromir Kamler
______________________________________________________________
> Od: systemguards@gmail.com
> Komu: kamler@centrum.cz
> CC: pgsql-novice@postgresql.org
> Datum: 04.10.2005 23:51
> Předmět: Re: stupid SQL question, how reach different rows of two almost same tables
>
> On 10/4/05, Jaromír Kamler <kamler @centrum.cz=""> wrote:
> > I am sorry, I know that this is an SQL problem ... . I need reach
> different
> > rows in 2 almost same tables. I need use it in PL/pgSQL. Thanks for your
> > advidce.
> >
> >
>
> this works?...
>
> create temp table t1 as
> select * from (select * from foo1 intersect select * from foo2) as
> tmp_foo;
>
> select * from (select * from foo1 except select * from t1) as tmp_foo1
> union
> select * from (select * from foo2 except select * from t1) as tmp_foo2;
>
>
> --
> regards,
> Jaime Casanova
> (DBA: DataBase Aniquilator ;)
> </kamler>


pgsql-novice by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Schema handling within plpgsql
Next
From: Steve Tucknott
Date:
Subject: Tranactions and viewing updated data