JOINING TWO TABLES

From: vamseelist(at)gmail(dot)com
To: pgsql-novice(at)postgresql(dot)org
Subject: JOINING TWO TABLES
Date: 2007-08-06 16:07:54
Message-ID: d5a501400708060907h7cd5d5dey8f762cb845655e6e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi ,
I have two tables
First table is employee table

EMP_ID Ename MGR_ID
---------- -- ----------
1 a 1
2 b 1
3 c 2

Second one is manager table

MGR_ID Manager name
---------- --------------------
1 d
2 e

as managers are employees i joined those two tables
the result is

EMP_ID EM MGR_ID
---------- -- ----------
4 d
5 e
1 a 1
2 b 1
3 c 2

now i would like to give emp ids to mgr ids.

I mean d,e got 1 and 2 in mgr table.
d,e got 4,5 in new table.

I would like to replace 1 1 2 with 4 4 5.

I would like to modify above table as

EMP_ID EM MGR_ID
---------- -- ----------
4 d
5 e
1 a 4
2 b 4
3 c 5

Plz help me
Thanks
satya

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Richard Broersma Jr 2007-08-06 16:27:35 Re: JOINING TWO TABLES
Previous Message Tom Lane 2007-08-06 15:36:01 Re: doubt about datum