Problem how to combine to two tables

Поиск
Список
Период
Сортировка
От Torsten Willrich
Тема Problem how to combine to two tables
Дата
Msg-id 000b01c1d58a$342d6d40$6a866099@iese.fhg.de
обсуждение исходный текст
Ответы 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>)
Список 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 по дате отправления:

Предыдущее
От: "Peter Galbavy"
Дата:
Сообщение: Non-use of index ?
Следующее
От: "Andrew G. Hammond"
Дата:
Сообщение: Re: Possible to do this in one query?