该查询使用到了json函数,if函数
SELECT
oc.users_mission_id AS ID,
oc.credit AS 未核实的利润,
IF
(
IF
(
`m`.`other_server` = '0',
0,
json_length ( `m`.`other_server` )),(
json_length ( `m`.`other_server` )* 10
)+ m.credits,
m.credits
) AS 原始积分,
(select credit from order_credit where users_mission_id = oc.users_mission_id and order_type = 13) as 奖励1,
(select credit from order_credit where users_mission_id = oc.users_mission_id and order_type = 3 and account_type = 1) as 获得的积分,
(select sum(credit) from order_credit where users_mission_id = oc.users_mission_id and order_type = 18 and account_type = 1) as 邀请机制
FROM
`order_credit` `oc`
LEFT JOIN `mission` `m` ON `oc`.`mission_id` = `m`.`id`
WHERE
`oc`.`uid` = 188
AND oc.account_type = 1
AND oc.add_time > UNIX_TIMESTAMP( '2021-02-28' )
AND oc.add_time <= UNIX_TIMESTAMP( '2021-02-28 23:59:59' )