Re: stupid SQL question, how reach different rows of two almost same tables

From: " Jaromír Kamler" <kamler(at)centrum(dot)cz>
To: <systemguards(at)gmail(dot)com>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: stupid SQL question, how reach different rows of two almost same tables
Date: 2005-10-06 10:53:14
Message-ID: 200510061253.25931@centrum.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)com
> Komu: kamler(at)centrum(dot)cz
> CC: pgsql-novice(at)postgresql(dot)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>

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Steve Tucknott 2005-10-06 11:23:10 Tranactions and viewing updated data
Previous Message Michael Fuhr 2005-10-06 06:23:40 Re: Schema handling within plpgsql