navicat查询转换json
使用CONCAT

SELECT
CONCAT(‘{“subId”:’,‘"’,af.sub_job_id,‘"’,‘,“registerTime”:’,‘"’,ap.register_time,‘"’,‘,“money”:’,‘"’,af.expend_money,‘"’,‘,“status”:’,‘"’,ap.download_state,‘"’,‘,“jobCreateUserId”:’,‘"’,ap.job_create_user_id,‘"’,‘,“jobId”:’,‘"’,ap.job_id,‘"’,‘,“userId”:’,‘"’,af.user_id,‘"’,‘}’)
FROM
ac_product_expend_flow af
LEFT JOIN ac_product_job ap on ap.sub_job_id = af.sub_job_id
WHERE
af.user_id IN ( ‘1200000072064ccc0172065335793745’, ‘1200000072064ccc0172065449954d58’, ‘1200000072064ccc01720655a69e2e4d’, ‘800000007201540101720154016d0000’ )
AND af.create_time >= ‘2020-06-05 16:55:00’

//查询出来的语句 是多条insert替换uuid就可以执行

替换’uuid’为 (select replace(UUID(),‘-’,‘’))

SELECT
CONCAT(“INSERT INTO uc_user_price_group_discount ( id, user_id, discount_group_id, price_discount, status, start_time, end_time, create_time,update_time)
VALUES”,“('”,‘uuid’,“‘,’”,user_id,“‘,’”,(SELECT id FROM uc_user_group_discount WHERE name=‘GPU折扣组’),“',”,gpu_discount,“,”,is_enable,“,'”,start_time,“‘,’”,end_time,“‘,’”,create_time,“‘,’”,update_time,“');”)
FROM uc_user_price_validate;

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐