Newbie select question: How to get the same column twice?

From: Paul Bramel <paulbr_at_comm.mot.com>
Date: 1996/01/05
Message-ID: <shybrmh86v.fsf_at_ra749.comm.mot.com>#1/1


I very new to SQL and could use some help with a select statement. How do I select the same column twice from one select statement?

Here is a simple example:

Table EMP:

 Name                            Null?    Type

------------------------------- -------- ----
ID NOT NULL NUMBER NAME VARCHAR2(10) Table ASSET: Name Null? Type
------------------------------- -------- ----
NAME VARCHAR2(20) OWNER NUMBER USR NUMBER

where owner and usr are both foreign keys referencing EMP.ID.

How do I select the asset name, owner name, and user name in one select statement? The following returns no rows.

SELECT asset.name, emp.name Owner, emp.name user_name

	FROM emp, asset
	WHERE asset.owner = emp.id
	AND asset.usr = emp.id

I've tried many variations on the above statement with no luck. Any help would be appreciated.

Thanks,

Paul Bramel Received on Fri Jan 05 1996 - 00:00:00 CET

Original text of this message