MySQL使用json_extract 函数过滤满足条件的json串

摘要:
字段中存的字符串为json串,需要取出"is_split":"0"的行,{"channel":"weibo","entrance":"main","order_id":"16770027","result":{"fund_result":{"service_fee_rate":"12","split_type":"baoxian","is_face":1,"period_unit":"002007

字段中存的字符串为json串,需要取出"is_split": "0"的行,

{
	"channel": "weibo",
	"entrance": "main",
	"order_id": "16770027",
	"result": {
		"fund_result": {
			"service_fee_rate": "12",
			"split_type": "baoxian",
			"is_face": 1,
			"period_unit": "002007002",
			"is_push_credit": "0",
			"overdue_limit": "0",
			"overdue_fine_limit": "1",
			"priod_unit": "MONTH",
			"is_revolving": 1,
			"fund_code": "JLXD",
			"is_report_credit": 0,
			"is_depositary": 0,
			"balance": "3000000",
			"fund_late_fee_rate": "0",
			"fund_loan_rate": "24",
			"main_total_rate": "24",
			"is_self": 1,
			"qy_balance": "",
			"loan_time": "[00:00,22:00]",
			"overdue_fine_version": "1.0",
			"backup_fund_count": 1,
			"is_query_credit": 0,
			"is_bankacc": 0,
			"age_limit": "[18,60]",
			"is_split": "0",
			"main_overdue_fine_rate": "0.1",
			"insurance_rate": "7.2",
			"white_overdue_fine_rate": "0",
			"is_on": 1,
			"fund_name": "江铃小贷",
			"service_interest_accrual_method": "002004005",
			"cooperation_model": "fund",
			"main_service_calculation_method": "002004005",
			"master": "wj",
			"is_coupon": 0,
			"product_period": 6,
			"unit": 100,
			"main_penalty_rate": "3",
			"white_penalty_rate": "0",
			"bank_list": "ICBC,CCB,BOC,ABC,CMB,CIB,CEB,SPDB,PAB,GDB,PSBC,CITIC,SHB,CBMC,HXB",
			"is_ocr_pic": "0",
			"fund_interest_accrual_method": "002004005",
			"overdue_fine_limit_rate": "36",
			"is_convert": 0,
			"is_relocated": "0"
		},
		"strategy_result": {
			"strategy_trail": "微博_主资金路由决策流:通过",
			"strategy_msg": "有备用-动态顺序规则集认证成功",
			"strategy_version": "83",
			"strategy_id": "2706",
			"strategy_name": "微博_主资金路由决策流"
		}
	},
	"scene": "weibo_cashloan",
	"source": "weibo",
	"type": "fund",
	"user_id": "31286006",
	"version": "1.2"
}

方法一 用like

SELECT
*
FROM
loan_info a
LEFT JOIN loan_product_fund_record b ON a.ID = b.LOAN_ID
LEFT JOIN third_credit_query_order c ON b.RISK_ID = c.ORDER_NO
WHERE
a.LENDING_TAG = 'jlxd'
AND a.LOAN_STATUS IN ('002001007', '002001005')
AND b.IS_SPLIT = 0
AND c.QUERY_RESULT like '%"is_split":"0"%';

方法二:json_extract

SELECT
*
FROM
loan_info a
LEFT JOIN loan_product_fund_record b ON a.ID = b.LOAN_ID
LEFT JOIN third_credit_query_order c ON b.RISK_ID = c.ORDER_NO
WHERE
a.LENDING_TAG = 'jlxd'
AND a.LOAN_STATUS IN ('002001007', '002001005')
AND b.IS_SPLIT = 0
AND json_extract (QUERY_RESULT, '$.result.fund_result.is_split') = '0'

免责声明:文章转载自《MySQL使用json_extract 函数过滤满足条件的json串》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇ASP.NET中EVAL用法大全jsonp 跨域下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel

Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel 1、MySQL安装【安装 MariaDB】MariaDB是MySQL的一个分支首先,更新升级系统$ sudo apt update$ sudo apt upgrade安装MariaDB:$ sudo apt install mariadb...

python之路——表操作

阅读目录   引擎介绍   表介绍   创建表   查看表结构   mysql中的数据类型   表的完整性约束   修改表结构   删除表   多表结构的创建与分析   作业 返回顶部 引擎介绍 mysql中的存储引擎(https://www.cnblogs.com/l-hf/p/11533999.html) 返回顶部 表介绍 表就相当于文...

MySQL/MariaDB数据库的查询缓存优化

MySQL/MariaDB数据库的查询缓存优化 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任。 一.MySQL架构 Connectors(MySQL对外提供的交互接口,API):   Connectors组件,是MySQL向外提供的交互组件,如Python,Golang,Java,C++,Php等语言可以通过该组件来操作SQL语句,实...

MYSQL获取自增ID的四种方法

1. select max(id) from tablename    2.SELECT LAST_INSERT_ID() 函数    LAST_INSERT_ID 是与table无关的,如果向表a插入数据后,再向表b插入数据,LAST_INSERT_ID会改变。    在多用户交替插入数据的情况下max(id)显然不能用。这时就该使用LAST_INSER...

Druid 架构

本篇译自 Druid项目白皮书部分内容( https://github.com/apache/incubator-druid/tree/master/publications/whitepaper/druid.pdf),如果有兴趣可看细看原pdf【初次翻译多多包涵】 一个 Druid 集群包含多种特定功能的节点, 我们相信这种设计能够分散业务并且简化整个系...

查询MySQL连接数

1.查看最大连接数: show variables like '%max_connections%'; 2.查看当前实时连接数: show status like 'Threads%'; 3.查看所有连接IP地址的连接数: select SUBSTRING_INDEX(host,':',1) as ip , count(*) from informatio...