simple select statement inquiry

From: Joseph Syjuco <joseph(at)asti(dot)dost(dot)gov(dot)ph>
To: pgsql-sql(at)postgresql(dot)org
Subject: simple select statement inquiry
Date: 2002-06-06 14:59:18
Message-ID: 3CFF78C6.82AEDF9A@asti.dost.gov.ph
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

table1
empno varchar(9) not null
peer varchar(9) not null references table2(empno)
superior varchar(9) not null references table2(empno)

table2
empno varchar(9)
firstname varchar(20)
lastname varchar(20)

what i want to do is get all entries in table 1 and transform peer and
superior fields (which contains empno) into their respective firstname +
lastname in one query

desired output
empno peer superior
1000 John Smith Henry Dunst
2000 Juan dela Cruz Pepe Smith

TIA
joseph

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2002-06-06 16:02:21 Re: Indexing timestamps
Previous Message Travis Hoyt 2002-06-06 12:47:49 Re: PostgreSQL on AIX