pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Torsten Willrich <willrich@iese.fhg.de>
To: pgsql-sql@postgresql.org
Subject: Problem how to combine to two tables
Date: Wed, 27 Mar 2002 13:23:29 +0100
Message-ID: <000b01c1d58a$342d6d40$6a866099@iese.fhg.de> (raw)

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?






view thread (3+ messages)  latest in thread

Message-ID: <000b01c1d58a$342d6d40$6a866099@iese.fhg.de>
Permalink:  ../000b01c1d58a$342d6d40$6a866099@iese.fhg.de/
Also on:    postgresql.org/message-id/000b01c1d58a$342d6d40$6a866099@iese.fhg.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: willrich@iese.fhg.de
  Subject: Re: Problem how to combine to two tables
  In-Reply-To: <000b01c1d58a$342d6d40$6a866099@iese.fhg.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox