JAVA、PHP、前端、APP、网站开发 - 开发技术学习

开发技术学习 » 数据库 » mysql in group_concat

mysql in group_concat

此文被围观2551日期: 2019-12-05 分类 : 数据库  标签:  ···
INSERT INTO tqk_finance (id, add_time, price, `status`, backcash, uid, income, mark, phone, `client`, ids) 
SELECT null, DATE_FORMAT(NOW(),'%Y-%m-%d'), SUM(list.pub_share_pre_fee), 2, 0, 0, SUM(list.user_rate), list.tk_earning_time, list.relation_id, 'app', GROUP_CONCAT(id) 
FROM (SELECT id,relation_id,DATE_FORMAT(tk_earning_time, '%Y-%m') as tk_earning_time,tk_status,pub_share_pre_fee,alimama_share_fee,user_rate FROM `tqk_order_app` 
where `tk_status` = 3 and is_sync=0) list GROUP BY list.relation_id,list.tk_earning_time;

UPDATE tqk_order_app SET is_sync=1 WHERE 
find_in_set(id, (SELECT GROUP_CONCAT(ids) FROM tqk_finance WHERE add_time=DATE_FORMAT(NOW(),'%Y-%m-%d') GROUP BY add_time)) and is_sync=0;

mysql更新group_concat语句。

select * from tab1 where find_in_set( id , select group_concat(ids) from tab2)


参考:https://blog.csdn.net/qq_30607881/article/details/78214312


站点声明:部分内容源自互联网,为传播信息之用,如有侵权,请联系我们删除。

© Copyright 2011-2024 www.kfju.com. All Rights Reserved.
超级字帖 版权所有。蜀ICP备12031064号