Reading list:
1. Update the name of the follower
2. Create a comparison table for the customer table
3. Query duplicate customers (total)
4. Query duplicate customers (five persons)
1. Update the name of the follower
UPDATE g_ec_customer SET follow_user_name = ( CASE follow_user_id WHEN '6582553' THEN '廖梓秀' WHEN '6582564' THEN '刘琪燕' WHEN '6624924' THEN '陈欣蕾' WHEN '6624972' THEN '袁良' WHEN '7166053' THEN '刘虎' WHEN '7166071' THEN ' Lin Longfei ' WHEN ' 7166183 ' THEN ' Chen Liguo ' WHEN ' 7240909 ' THEN ' Square Lei ' WHEN ' 7240941 ' THEN ' Wang Kaisheng ' WHEN ' 7360237 ' THEN ' Li Na ' WHEN ' 7360262 ' THEN ' Cheng Huizi ' END );
2. Create a comparison table for the customer table
CREATE TABLE g_ec_dist AS ( SELECT t.follow_user_name, t.crm_id, t.`name`, t.mobile, t.create_time FROM g_ec_customer t WHERE t.create_time <= '2018-04-30 23:59:59' AND t.follow_user_name != '' AND t.follow_user_name IS NOT NULL ORDER BY t.follow_user_name, t.create_time );
3. Query duplicate customers (total)
SELECT t.follow_user_name, t.crm_id, t.`name`, t.mobile, t.create_time, t2.follow_user_name, t2.crm_id, t2.`name`, t2.mobile, t2.create_time FROM g_ec_customer t, g_ec_dist t2 WHERE t.`name` = t2.mobile AND t.create_time != t2.create_time AND t.create_time <= '2018-04-30 23:59:59' AND t.follow_user_name != '' AND t.follow_user_name IS NOT NULL AND t.follow_user_name != t2.follow_user_name ORDER BY t.follow_user_name,t.create_time;
4. Query duplicate customers (five people)
SELECT t.follow_user_name, t.crm_id, t.`name`, t.mobile, t.create_time, t2.follow_user_name, t2.crm_id, t2.`name`, t2.mobile, t2.create_time FROM g_ec_customer t, g_ec_dist t2 WHERE t.`name` = t2.mobile AND t.create_time != t2.create_time AND t.create_time <= '2018-04-30 23:59:59' AND t.follow_user_name != '' AND t.follow_user_name IS NOT NULL AND t.follow_user_name != t2.follow_user_name AND (t.follow_user_name IN ('方磊','汪开胜','陈立国','刘虎', ' Lin Longfei ' ) OR t2.follow_user_name IN ( ' Fang Lei ' , ' Wang Kaisheng ' , ' Chen Liguo ' , ' Liu Hu ' , ' Lin Longfei ' )) ORDER BY t.follow_user_name ,t.create_time;