Re: sql problem

From: DanHW <danhw_at_aol.com>
Date: 24 Oct 1999 20:25:32 GMT
Message-ID: <19991024162532.20278.00000577_at_ng-ca1.aol.com>


>i have 2 tables A and B. table A has a py key col1 and a description
>field col2. table B has 2 columns....colx references col1 of table A
>and coly references col1 of table A.
>
>i need to get a report that lists as follows;
>
>colx corresponding-col2 coly corresponding-col2
>
>i would prefer it if i could create a view for this. i have spent the
>whole day on this with no luck.
>
>regards,
>raj
>

As I read this, you are joining to the same table twice. To do that, try something like

select b.colx, a1.col2, b.coly, a2.col2 from tableB b, tableA a1, tableA a2 where
b.colx=a1.col1 and b.coly =a2.col1

(Note the table alias)

HTH,
Dan Hekimian-Williams Received on Sun Oct 24 1999 - 22:25:32 CEST

Original text of this message