Version 2021

Self Join

No PostgreSQL specific customizations were made for this feature.

A self-join is a join of a table to itself. This table appears twice in the FROM clause and is followed by table aliases that qualify column names in the join condition. To perform a self-join, the PostgreSQL database combines and returns rows of the table that satisfy the join condition.  

The following sample query demonstrates how MicroStrategy supports a self join against PostgreSQL

Copy
c1.C_ADDRESS,  
c1.C_NAME customer_1,          
c2.C_NAME customer_2  
FROM  
tpch.CUSTOMER c1  
INNER JOIN tpch.CUSTOMER c2 ON c1.C_CUSTKEY> c2.C_CUSTKEY  
AND c1.C_CUSTKEY<10  
ORDER BY  
customer_1,   
customer_2;