Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Can multiple joins be avoided for the same table? - response (1) by qbeg00

$
0
0

Hello,

I think You want somethink like this:

SELECT
A.Group_ID,
B.Value1 as Group_val1,
B.Value2 as Group_val2,
A.member_ID,
C.Value1 as Member_val1,
C.Value2 as Member_val2
FROM Database.Table1 A
LEFT JOIN Database.Table2 B
ON A.Group_ID=B.ID
LEFT JOIN Database.Table2 C
ON A.member_ID=C.ID
ORDER BY 1,4

Regards
Peter


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>