我有这个mmysql查询,它正确地提取了所有字段,除了'code'字段外,在整个结果中都为空。
这是我正在使用的脚本:
select id, guid,
json_unquote(json_extract(jurisdictions, '$[0].lang')) as lang,
json_unquote(json_extract(jurisdictions, '$[0].startDate')) as start_date,
json_unquote(json_extract(jurisdictions, '$[0].isStartDateComputed')) as is_start_date_computed,
json_unquote(json_extract(jurisdictions, '$[0].reportedDate')) as reported_date,
json_unquote(json_extract(jurisdictions, '$[0].governmentLevelType')) as govt_level_type,
json_unquote(json_extract(jurisdictions, '$[0].governmentLevelTypeGuid')) as govt_level_type_guid,
json_unquote(json_extract(jurisdictions, '$[0].jurisdictionLevel')) as jdx_level,
json_unquote(json_extract(jurisdictions, '$[0].jurisdictionLevelGuid')) as jdx_level_guid,
json_unquote(json_extract(jurisdictions, '$[0].codedRepresentation[0].codedSubjectMatterType')) as coded_subject_matter_type,
json_unquote(json_extract(jurisdictions, '$[0].codedRepresentation[0].codedSubjectMatterTypeGuid')) as coded_subject_matter_type_guid,
json_unquote(json_extract(jurisdictions, '$[0].codedRepresentation[0].code')) as code,
json_unquote(json_extract(jurisdictions, '$[0].codedRepresentation[0].codedGovernmentSystem')) as coded_govt_system,
json_unquote(json_extract(jurisdictions, '$[0].codedRepresentation[0].codedGovernmentSystemGuid')) as coded_govt_system_guid,
json_unquote(json_extract(jurisdictions, '$[0].codedRepresentation[0].codedGeographicTerritory')) as coded_geo_territory,
json_unquote(json_extract(jurisdictions, '$[0].codedRepresentation[0].codedGeographicTerritoryGuid')) as coded_geo_territory_guid
从法院 ;
这是我要从中提取数据的示例数组:
"jurisdictions" : "[{\"lang\": \"en\", \"startDate\": \"2012-04-10\", \"isStartDateComputed\": true, \"governmentLevelType\": \"State\", \"governmentLevelTypeGuid\": \"urn:propertyValueItem:0D85EC301A4A461AB8A71270D40E9FE5\", \"jurisdictionLevel\": \"Intermediate Appeals\", \"codedRepresentation\": {\"codedSubjectMatterTypeGuid\": \"urn:propertyValueItem:7E1B0257EFFB4A4BA6E6672158B105E1\", \"code\": \"US-TN.APL-CRM.EGD\", \"codedGovernmentSystemGuid\": \"urn:propertyValueItem:1F1D25A1D9A24D699499B678DA2CBEAF\", \"codedGeographicTerritoryGuid\": \"urn:propertyValueItem:A99D07C64F004068B213206A364FCC3C\", \"codedGeographicTerritory\": \"EGD\", \"codedSubjectMatterType\": \"APL-CRM\", \"codedGovernmentSystem\": \"US-TN\"}, \"geopoliticalBodies\": [], \"jurisdictionLevelGuid\": \"urn:propertyValueItem:53B0C6AF9A68462A98D7B49F3A9014F0\", \"reportedDate\": \"2018-12-18\"}]",
由于某种原因,我得到了我想要的一切,除了从这一行中什么也得不到:
json_unquote(json_extract(jurisdictions, '$[0].codedRepresentation[0].code')) as code,
何时该回来(基于上面提供的示例数据):
US-TN.APL-CRM.EGD
我不确定为什么仅在此字段上会发生这种情况,但是任何帮助将不胜感激。谢谢!