解决数据库中的标准化问题

Ste*_*ven 3 sql database standards ms-access

在MS Access 2013中工作.有大量需要标准化的位置/地址.

示例包括以下地址:

  • 500 W Main St
  • 500 West Main St
  • 西大街500号

你明白了.

我已经考虑过运行一个查询来提取数据库中左(7)或某些字符不止一次存在的所有记录,但该逻辑中存在明显的缺陷.

是否有一个函数或查询或其他任何可以帮助我生成一个地址可能存在多次的记录列表,以略有不同的方式?

Joh*_*tti 13

这是一项棘手的业务......等同于黑魔法和科学.你会惊讶于大道的变化.

这就是我使用Google API的原因.对于初始数据集,这可能是耗时的,但是仅需要解决新的添加.

例如

https://maps.googleapis.com/maps/api/geocode/json?address=500 S Main St,Providence RI 02903
Run Code Online (Sandbox Code Playgroud)

部分返回

"formatted_address" : "500 S Main St, Providence, RI 02903, USA"
Run Code Online (Sandbox Code Playgroud)

和GOOD新闻是

https://maps.googleapis.com/maps/api/geocode/json?address=500 South Main Steet,Providence RI 02903
Run Code Online (Sandbox Code Playgroud)

返回与上一个查询相同的格式化地址

"formatted_address" : "500 S Main St, Providence, RI 02903, USA"
Run Code Online (Sandbox Code Playgroud)

VBA示例:

执行以下代码时......

' VBA project Reference required:
' Microsoft XML, v3.0

Dim httpReq As New MSXML2.ServerXMLHTTP
httpReq.Open "GET", "https://maps.googleapis.com/maps/api/geocode/json?address=500 South Main Steet,Providence RI 02903", False
httpReq.send
Dim response As String
response = httpReq.responseText
Run Code Online (Sandbox Code Playgroud)

...字符串变量response包含以下JSON数据:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "500",
               "short_name" : "500",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "South Main Street",
               "short_name" : "S Main St",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Fox Point",
               "short_name" : "Fox Point",
               "types" : [ "neighborhood", "political" ]
            },
            {
               "long_name" : "Providence",
               "short_name" : "Providence",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Providence County",
               "short_name" : "Providence County",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "Rhode Island",
               "short_name" : "RI",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "United States",
               "short_name" : "US",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "02903",
               "short_name" : "02903",
               "types" : [ "postal_code" ]
            },
            {
               "long_name" : "2915",
               "short_name" : "2915",
               "types" : [ "postal_code_suffix" ]
            }
         ],
         "formatted_address" : "500 S Main St, Providence, RI 02903, USA",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 41.82055829999999,
                  "lng" : -71.4028137
               },
               "southwest" : {
                  "lat" : 41.8204014,
                  "lng" : -71.40319219999999
               }
            },
            "location" : {
               "lat" : 41.8204799,
               "lng" : -71.40300289999999
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : 41.8218288302915,
                  "lng" : -71.40165396970851
               },
               "southwest" : {
                  "lat" : 41.8191308697085,
                  "lng" : -71.40435193029151
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJicPQAT9F5IkRfq2njkYqZtE",
         "types" : [ "premise" ]
      }
   ],
   "status" : "OK"
}
Run Code Online (Sandbox Code Playgroud)