Sunday, July 25, 2010

Write a SQL query that displays relation between parent and child from the following table

Geography table
SKGeographyID
Geography
SKParentGeographyID
Europe 
         NULL
America 
         NULL
Undisclosed 
         NULL
Hong Kong 
          1
New Zealand
          2
Singapore 
          1
Malaysia
          2
Japan 
          3 
Brazil
          3 

 
Select A.Geography, (SELECT Geography
FROM DW.DimGeography B WHERE B.SkGeographyId = A.SkParentGeographyId ) FROM DW.DimGeography A

No comments:

Post a Comment


All Rights Reserved @ Raju Das