1

我有这个 mmysql 查询可以正确提取所有字段,除了“代码”字段,该字段在结果中始终为空。

这是我正在使用的脚本:

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

我不确定为什么仅在该领域会发生这种情况,但我们将不胜感激。谢谢!

4

0 回答 0