Problem how to combine to two tables - Mailing list pgsql-sql

From Torsten Willrich
Subject Problem how to combine to two tables
Date
Msg-id 000b01c1d58a$342d6d40$6a866099@iese.fhg.de
Whole thread Raw
Responses Re: Problem how to combine to two tables  ("Andrew G. Hammond" <drew@xyzzy.dhs.org>)
Re: Problem how to combine to two tables  (Masaru Sugawara <rk73@sea.plala.or.jp>)
List pgsql-sql
Ok, to explain my problem, it is the easiest way, to make an example:

let's say we have two tables:

Table1 looks like this:

Employee_ID        Room
------------------------
{1,3}            201
{3}            202

And Table2 looks like this:

ID    Employee
---------------
1    Torsten
2    Markus
3    Daniel

This means, that if the two tables are linked properly, that Torsten and
Daniel sit in room no. 201 and Markus in room No. 202. And linking properly
is my problem:

I want an output like this

Employee_ID        Room    ID    Employee
{1,3}            201    1    Torsten
{1,3}            201    3    Daniel
{2}            202    2    Markus

That means, that the SELECT-statement has to be something like this:
SELECT * from Table1,Table2 where Table1.Employee_ID=Table2.ID;

But of course this doesn't work, because I can't compare an int to a set of
int :-(

Does anyone know how to do this correct?





pgsql-sql by date:

Previous
From: "Peter Galbavy"
Date:
Subject: Non-use of index ?
Next
From: "Andrew G. Hammond"
Date:
Subject: Re: Possible to do this in one query?