Mysql database operation

Update data from one table to another:

UPDATE
   cflow c, order o
SET
   c.order_no = o.order_no
WHERE
   a.`name` = o.`name`

A field in the table is in json format stored in varchar, if you want to get the value corresponding to an attribute in json

SELECT REPLACE(REPLACE(UNHEX(SUBSTRING(HEX(remark),1,LENGTH(SUBSTRING_INDEX(HEX(remark),HEX(','),1)))),'"HandleFee":"',''),'"','') AS HandleFee, created_at, app_type, order_no, trade_money, platform_type
FROM (
	SELECT UNHEX(SUBSTRING(HEX(remark),LENGTH(SUBSTRING_INDEX(HEX(remark),HEX('TranAmount'),1))-1,LENGTH(HEX(remark)))) AS remark, created_at, app_type, order_no, trade_money, platform_type
	FROM `admin_bank_handle_record`
	WHERE handle_type = 1 AND record_status = 3) AS a;

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326047820&siteId=291194637