pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joseph Syjuco <joseph@asti.dost.gov.ph>
To: pgsql-sql@postgresql.org
Subject: simple select statement inquiry
Date: Thu, 06 Jun 2002 10:59:18 -0400
Message-ID: <3CFF78C6.82AEDF9A@asti.dost.gov.ph> (raw)

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



view thread (3+ messages)  latest in thread

Message-ID: <3CFF78C6.82AEDF9A@asti.dost.gov.ph>
Permalink:  ../3CFF78C6.82AEDF9A@asti.dost.gov.ph/
Also on:    postgresql.org/message-id/3CFF78C6.82AEDF9A@asti.dost.gov.ph

 · 

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: joseph@asti.dost.gov.ph
  Subject: Re: simple select statement inquiry
  In-Reply-To: <3CFF78C6.82AEDF9A@asti.dost.gov.ph>

* 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