-- ROLLBACK -- Shinjuku update contacts set `custom_var17` = `custom_var1` where `school_id`='sssssss-1111'; update contacts set `custom_var18` = `custom_var2` where `school_id`='sssssss-1111'; update contacts set `custom_var19` = `custom_var3` where `school_id`='sssssss-1111'; update contacts set `custom_var20` = `custom_var4` where `school_id`='sssssss-1111' and contact_status=0; update contacts set `custom_var20` = `custom_var4` where `school_id`='sssssss-1111' and contact_status=7; update contacts set `custom_var20` = `custom_var8` where `school_id`='sssssss-1111' and contact_status=5; -- Nagoya update contacts set `custom_var18` = `custom_var5` where `school_id`='483794c4-adee-a607-f685-4441c943a1e2'; update contacts set `custom_var19` = `custom_var6` where `school_id`='483794c4-adee-a607-f685-4441c943a1e2'; update contacts set `custom_var20` = `custom_var7` where `school_id`='483794c4-adee-a607-f685-4441c943a1e2'; UPDATE contacts SET custom_var1=NULL where `school_id`='sssssss-1111'; UPDATE contacts SET custom_var2=NULL where `school_id`='sssssss-1111'; UPDATE contacts SET custom_var3=NULL where `school_id`='sssssss-1111'; UPDATE contacts SET custom_var4=NULL where `school_id`='sssssss-1111'; UPDATE contacts SET custom_var8=NULL where `school_id`='sssssss-1111'; UPDATE contacts SET custom_var5=NULL where `school_id`='483794c4-adee-a607-f685-4441c943a1e2'; UPDATE contacts SET custom_var6=NULL where `school_id`='483794c4-adee-a607-f685-4441c943a1e2'; UPDATE contacts SET custom_var7=NULL where `school_id`='483794c4-adee-a607-f685-4441c943a1e2'; --Shinjuku UPDATE `contacts` SET description = NULL WHERE school_id='sssssss-1111' and contact_status!=5; delete from contacts where school_id='sssssss-1111' and contact_status=5; update contacts set description=concat_ws('\r\n', `description`, concat('余った金額: ',`custom_var17`)) where school_id='sssssss-1111' and custom_var17!='' ; update contacts set description=concat_ws('\r\n', `description`, concat('休校・退校日 理由: ',`custom_var18`)) where school_id='sssssss-1111' and custom_var18!='' ; update contacts set description=concat_ws('\r\n', `description`, concat('新宿旧割引: ',`custom_var19`)) where school_id='sssssss-1111' and custom_var19!='' ; update contacts set description=concat_ws('\r\n', `description`, concat('所属クラス:',`custom_var20`)) where school_id='sssssss-1111' and custom_var20!='' and contact_status!=5; -- Application Course update contacts set description=concat_ws('\r\n', `description`, concat('体験コース:',`custom_var20`)) where school_id='sssssss-1111' and custom_var20!='' and contact_status=5; -- Nagoya update contacts set description=concat_ws('\r\n', `description`, concat('受講言語:',`custom_var18`)) where `school_id`='483794c4-adee-a607-f685-4441c943a1e2' and custom_var18!='' ; update contacts set description=concat_ws('\r\n', `description`, concat('先生:',`custom_var19`)) where `school_id`='483794c4-adee-a607-f685-4441c943a1e2' and custom_var19!='' ; update contacts set description=concat_ws('\r\n', `description`, concat('内訳:',`custom_var20`)) where `school_id`='483794c4-adee-a607-f685-4441c943a1e2' and custom_var20!='' ; -- Osaka update contacts set description=concat_ws('\r\n', `description`, concat('',`custom_var16`)) where `school_id`= '99305ae3-8a14-d247-9ba8-45036e75ddef' and custom_var16!='' ; update contacts set description=concat_ws('\r\n', `description`, concat('ID番号: ',`custom_var17`)) where `school_id`= '99305ae3-8a14-d247-9ba8-45036e75ddef' and custom_var17!='' ; update contacts set description=concat_ws('\r\n', `description`, concat('コース名: ',`custom_var18`)) where `school_id`= '99305ae3-8a14-d247-9ba8-45036e75ddef' and custom_var18!='' ; update contacts set description=concat_ws('\r\n', `description`, concat('コースコード: ',`custom_var19`)) where `school_id`= '99305ae3-8a14-d247-9ba8-45036e75ddef' and custom_var19!='' ; -- Custom variable Discount payment UPDATE contacts SET `custom_var11` = `custom_var19` WHERE `school_id` = 'sssssss-1111' AND custom_var19 != ''