mysql 从json字符串中获取指定的key:

  • 作者: 凯哥Java(公众号:凯哥Java)
  • mysql
  • 时间:2021-05-06 14:52
  • 4187人已阅读
简介 SELECTSUBSTR(detail,  LOCATE('"email"',detail)+LENGTH('"email":"'),  LOCATE('",',detail,LOCATE('"email"',det

🔔🔔🔔好消息!好消息!🔔🔔🔔

有需要的朋友👉:联系凯哥 微信号 kaigejava2022

SELECT
SUBSTR(detail,
   LOCATE('"email"',detail)+LENGTH('"email":"'),
   LOCATE('",', detail,LOCATE('"email"',detail))-(LOCATE('"email"',detail)+LENGTH('"email":"'))) AS email
FROM tb_sync_moka2oa_full_detail where moka_id in ( 62923,
   64242,
   66971,
   67197,
   67198,
   67304,
   74124) and is_delete = 0 order by id desc limit 50  ;

虽然mysql 5.7之后支持 JSON_EXTRACT 了,我测试了下好像不行

TopTop