sql 马来西亚地理区域详情

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 马来西亚地理区域详情相关的知识,希望对你有一定的参考价值。

WITH 
 district_table AS (
  SELECT
    code AS d_code,
    description AS d_description,
    parent AS d_parent
  FROM
    `propertyguru-datalake-v0.propertydb_staging.my_geographic_area`
  WHERE type_code = 'D'
  AND country = 'MY'
  ),
  
  area_table AS (
  SELECT
    code AS a_code,
    description AS a_description,
    parent AS a_parent
  FROM
    `propertyguru-datalake-v0.propertydb_staging.my_geographic_area`
  WHERE type_code = 'A'
  AND country = 'MY'
  ),
  
  region_table AS (
  SELECT
    code AS r_code,
    description AS r_description
  FROM
    `propertyguru-datalake-v0.propertydb_staging.my_geographic_area`
  WHERE type_code = 'L'
  AND country = 'MY'
  ),
  
  final_table AS (
  SELECT 
  area.a_code,
  area.a_description AS Area,
  area.a_parent,
  district.d_code,
  district.d_description AS District,
  district.d_parent,
  region.r_code,
  region.r_description AS Region

  FROM region_table region
  LEFT JOIN district_table district
  ON district.d_parent = region.r_code
  LEFT JOIN area_table area
  ON area.a_parent = district.d_code
  )
  
  SELECT 
  Region,
  District,
  Area
  FROM final_table
  
  
  
  
  
  
  

以上是关于sql 马来西亚地理区域详情的主要内容,如果未能解决你的问题,请参考以下文章

sql 马来西亚聚焦清单

sql 马来西亚信贷使用表

sql 马来西亚地区专家

sql 马来西亚物业展

sql 马来西亚房地产展2018年12月

地理分布式Azure应用程序与单区域