2017-08-19 75 views

回答

0

下面的SQL可以提供期望的輸出

SELECT  P1.PID AS PRODUCT_ID, 
      P1.STATUS AS PRODUCT_STATUS, 
      P2.PID AS MASTER_ID, 
      P2.STATUS AS MASTER_STATUS 
FROM  PRODUCTS AS P1 
INNER JOIN PRODUCTS AS P2 
ON   P1.MASTER = P2.PID 

輸出

PRODUCT_ID PRODUCT_STATUS  MASTER_ID MASTER_STATUS 
---------------------------------------------------------- 
1234  Active    7473  Active 
3457  Active    7473  Active 
3685  Disabled   7473  Active