SELECT instructor.last_name, instructor.first_name, instructor.INSTRUCTOR_NUMBER, 
class.`CLASS_NAME`, class.`CHARGE_ADMISSION_FEE`,
class.`CHARGE_MONTHLY_FEE`,
class.`CHARGE_EXPERIENCE_FEE`,
class.`CHARGE_MATERIAL_FEE`,
class.`CHARGE_FACILITY_FEE`
FROM class
JOIN instructor ON instructor.INSTRUCTOR_NUMBER = class.INSTRUCTOR_NUMBER  WHERE 1;

SELECT instructor.INSTRUCTOR_NUMBER, instructor.last_name, instructor.first_name, 
class.`CLASS_NAME`, class.CLASS_NUMBER,
class.`CHARGE_ADMISSION_FEE`,
class.`CHARGE_MONTHLY_FEE`,
class.`CHARGE_EXPERIENCE_FEE`,
class.`CHARGE_MATERIAL_FEE`,
class.`CHARGE_FACILITY_FEE`
FROM class
JOIN instructor ON instructor.INSTRUCTOR_NUMBER = class.INSTRUCTOR_NUMBER  AND instructor.CTL_DELETE_FLAG IS NULL
WHERE class.CTL_DELETE_FLAG IS NULL;


-- 2009-03-05
UPDATE `sms_transactiontype` SET `deleted` = '1' WHERE CONVERT( `sms_transactiontype`.`id` USING utf8 ) = '17' LIMIT 1 ;

-- 2009-03-07
UPDATE sms_fee, `sms_fee_template_fix` SET sms_fee.basic_fee = sms_fee_template_fix.basic_fee WHERE sms_fee.id = sms_fee_template_fix.id;


SELECT * FROM `sms_fee` WHERE name LIKE "%教材費%" AND fee_subcategory LIKE "%facility_madoguchi%";

UPDATE sms_fee SET name = REPLACE(name, '教材費', '設備費' ) WHERE name LIKE "%教材費%" AND fee_subcategory LIKE "%facility_madoguchi%";


-- 2009-03-09
UPDATE sms_fee, sms_fee_origin SET sms_fee.sell_date = sms_fee_origin.sell_date  WHERE sms_fee.salesno = sms_fee_origin.salesno;
UPDATE sms_fee, sms_transaction SET sms_transaction.sell_date = sms_fee.sell_date WHERE sms_fee.id = sms_transaction.fee_id;

SELECT * FROM `sms_fee` WHERE name LIKE "%設備費%" AND fee_subcategory LIKE "%textbook_madoguchi%";
UPDATE sms_fee SET name = REPLACE(name, '設備費', '教材費' ) WHERE name LIKE "%設備費%" AND fee_subcategory LIKE "%textbook_madoguchi%";

SELECT * FROM `sms_fee` WHERE `basic_fee` =945 AND `fee_subcategory` LIKE '%facility%';
UPDATE sms_fee SET basic_fee=315 WHERE `basic_fee` =945 AND `fee_subcategory` LIKE '%facility%'; 

UPDATE sms_fee SET basic_fee= basic_fee/3 WHERE fee_subcategory='textbookA' AND contact_id IS NOT NULL AND contact_id!='' AND date_entered='2009-02-23 18:00:00';
UPDATE sms_fee SET basic_fee= basic_fee/3 WHERE fee_subcategory='textbookB' AND contact_id IS NOT NULL AND contact_id!='' AND date_entered='2009-02-23 18:00:00';
UPDATE sms_fee SET basic_fee= basic_fee/3 WHERE fee_subcategory='textbookC' AND contact_id IS NOT NULL AND contact_id!='' AND date_entered='2009-02-23 18:00:00';


UPDATE sms_fee SET name = REPLACE(name, '(月分)', '') WHERE name LIKE "%(月分)%" AND ( contact_id IS NULL OR contact_id='' );
UPDATE sms_fee SET name = REPLACE(name, '(窓口)', '') WHERE name LIKE "%(窓口)%" AND ( contact_id IS NULL OR contact_id='' );

UPDATE sms_fee SET name = REPLACE(name, '体験参加費', '体験料') WHERE name LIKE '%体験参加費%';


SELECT smsevent.id AS course_id, smsevent.name AS course_name, course_category.id AS cat_id, course_category.name AS category_name, cat.node_id
FROM `smsevent` 
LEFT JOIN course_category ON smsevent.parent_id = course_category.id
LEFT JOIN category_tree ON smsevent.id = self_id
LEFT JOIN category_tree AS cat ON cat.self_id = course_category.id
WHERE category_tree.self_id IS NULL ;

INSERT INTO category_tree
(self_id, parent_node_id, type)
SELECT smsevent.id AS course_id,  cat.node_id, 'Course'
FROM `smsevent` 
LEFT JOIN course_category ON smsevent.parent_id = course_category.id
LEFT JOIN category_tree ON smsevent.id = self_id
LEFT JOIN category_tree AS cat ON cat.self_id = course_category.id
WHERE category_tree.self_id IS NULL;

UPDATE sms_fee SET name = REPLACE(name, '料金名', '授業料') WHERE fee_subcategory LIKE "%tuition%";
UPDATE sms_fee SET name = REPLACE(name, '料金名', '設備費') WHERE fee_subcategory LIKE "%facility%";
UPDATE sms_fee SET name = REPLACE(name, '料金名', '教材費') WHERE fee_subcategory LIKE "%textbook%";

UPDATE `sms_fee` SET jikyu_rate=1;

UPDATE sms_fee, sms_transaction SET actual_in_amount = basic_fee, in_amount = basic_fee WHERE fee_id = sms_fee.id;


-- 2009-03-13
UPDATE MEMBER, contacts SET phone_mobile = CONCAT_WS('-',MOBILE_PHONE1,MOBILE_PHONE2,MOBILE_PHONE3)
WHERE contacts.id = MEMBER.id ;

UPDATE sms_fee SET name=REPLACE(name, '入学金', '入会金') WHERE name='入学金';


-- 2009-04-07
UPDATE sms_fee SET unit_type= '0' WHERE  fee_subcategory LIKE "%madoguchi%";
UPDATE sms_fee SET unit_type= '0' WHERE  fee_subcategory LIKE "%trial%";
UPDATE sms_fee SET unit_type= '0' WHERE  fee_subcategory LIKE "%entrance%";


SELECT name,fee_subcategory, CHARACTER_LENGTH(name),LOCATE("(", name), LOCATE(")", name), SUBSTRING(name,LOCATE("(", name), LOCATE(")", name))  FROM `sms_fee` WHERE 1;
UPDATE sms_fee SET name=REPLACE(name, '(窓口)','');

UPDATE sms_fee SET name = CONCAT_WS(' ', "入会金",SUBSTRING(name,LOCATE("(", name), LOCATE(")", name)) ) WHERE fee_subcategory = 'entrance';

UPDATE sms_fee SET name = CONCAT_WS(' ', "授業料",SUBSTRING(name,LOCATE("(", name), LOCATE(")", name)) )
WHERE ( fee_subcategory = 'tuitionA' OR fee_subcategory='tuitionB' OR fee_subcategory='tuitionC' OR fee_subcategory='tuition_madoguchi');

UPDATE sms_fee SET name = CONCAT_WS(' ', "教材費",SUBSTRING(name,LOCATE("(", name), LOCATE(")", name)) )
WHERE ( fee_subcategory = 'textbookA' OR fee_subcategory='textbookB' OR fee_subcategory='textbookC' OR fee_subcategory='textbook_madoguchi');

UPDATE sms_fee SET name = CONCAT_WS(' ', "設備費",SUBSTRING(name,LOCATE("(", name), LOCATE(")", name)) )
WHERE ( fee_subcategory = 'facilityA' OR fee_subcategory='facilityB' OR fee_subcategory='facilityC' OR fee_subcategory='facility_madoguchi');

UPDATE  `sms_transaction` SET due_date = sell_date WHERE sell_date>'2008-11-31' AND sell_date<'2009-01-01';
UPDATE  `sms_transaction` SET due_date = sell_date WHERE sell_date>'2008-12-31' AND sell_date<'2009-02-01';

UPDATE  `sms_transaction` SET due_date = sell_date WHERE  sell_date<'2008-12-01';

UPDATE sms_fee SET name = '入会金' WHERE fee_subcategory='entrance';

-- 2009-04-08
UPDATE contacts SET custom_var7 = CONCAT_WS('',"000",custom_var7) WHERE CHAR_LENGTH( custom_var7 ) =1;
UPDATE contacts SET custom_var7 = CONCAT_WS('',"00",custom_var7) WHERE CHAR_LENGTH( custom_var7 ) =2;
UPDATE contacts SET custom_var7 = CONCAT_WS('',"0",custom_var7) WHERE CHAR_LENGTH( custom_var7 ) =3;

UPDATE contacts SET custom_var9 = CONCAT_WS('',"00",custom_var9) WHERE CHAR_LENGTH( custom_var9 ) =1;
UPDATE contacts SET custom_var9 = CONCAT_WS('',"0",custom_var9) WHERE CHAR_LENGTH( custom_var9 ) =2;


-- 2009-04-09
UPDATE contacts SET custom_var13 = CONCAT_WS('',"00",custom_var13) WHERE CHAR_LENGTH( custom_var13 ) =5;
UPDATE contacts SET custom_var13 = CONCAT_WS('',"0",custom_var13) WHERE CHAR_LENGTH( custom_var13 ) =6;

UPDATE contacts,`nkaiin` SET custom_var16='no_member_fee' WHERE contacts.idnumber = member AND nkaiin =1;


-- 2009-04-10
SELECT custom_var9,custom_var19 FROM contacts WHERE smsgroup='teacher';

UPDATE contacts SET custom_var19 = custom_var9 WHERE smsgroup='teacher';
UPDATE contacts SET custom_var9 = NULL WHERE smsgroup='teacher';

UPDATE contacts SET custom_var7 = REPLACE(custom_var7, "000", "0") WHERE smsgroup='teacher';
UPDATE contacts SET custom_var7 = "12" WHERE smsgroup='teacher' AND custom_var7="0012";
UPDATE contacts SET custom_var7 = "11" WHERE smsgroup='teacher' AND custom_var7="0011";
UPDATE contacts SET custom_var7 = "10" WHERE smsgroup='teacher' AND custom_var7="0010";


UPDATE contacts SET custom_var19 = 0 WHERE smsgroup='teacher' AND custom_var19="000";
UPDATE contacts SET custom_var19 = 2 WHERE smsgroup='teacher' AND custom_var19="002";
UPDATE contacts SET custom_var19 = 6 WHERE smsgroup='teacher' AND custom_var19="006";
UPDATE contacts SET custom_var19 = 7 WHERE smsgroup='teacher' AND custom_var19="007";
UPDATE contacts SET custom_var19 = 10 WHERE smsgroup='teacher' AND custom_var19="010";
UPDATE contacts SET custom_var19 = 13 WHERE smsgroup='teacher' AND custom_var19="013";
UPDATE contacts SET custom_var19 = 14 WHERE smsgroup='teacher' AND custom_var19="014";
UPDATE contacts SET custom_var19 = 15 WHERE smsgroup='teacher' AND custom_var19="015";


-- 2009-04-13
INSERT INTO `sms_transactiontype` ( `id` , `name` , `deleted` , `date_entered` , `date_modified` , `modified_user_id` , `created_by` , `keiri_category` , `apply_new_student` , `show_in_edit_fee` , `keiri_code` , `description` ) 
VALUES (
'15', 'membership', '0', '2006-01-15 00:00:00', '2006-01-15 00:00:00', NULL , NULL , 'teacher', '0', '1', '665', 'Membership fee for teachers'
), (
'16', 'flier', '0', '2006-01-15 00:00:00', '2006-01-15 00:00:00', NULL , NULL , 'teacher', '0', '1', '665', 'Flier fee for teachers'
);


-- 2009-04-15
UPDATE contacts SET contact_status = '7' WHERE contact_status = '12' AND deleted='0' ;

UPDATE contacts SET leave_date = extra_date WHERE ( `extra_date` IS NOT NULL  AND extra_date !='') AND deleted=0;


-- 2009-04-23
UPDATE `sms_fee` SET fee_subcategory='tuition_onecoin', date_modified = '2009-04-23 15:32:23' WHERE fee_subcategory='trial' AND basic_fee='525';


-- 2009-04-24
UPDATE  `sms_transaction`, sms_fee SET sms_transaction.due_date = sms_transaction.sell_date WHERE sms_transaction.sell_date>'2009-01-31' AND sms_transaction.sell_date<'2009-03-01'
AND due_date<'2009-03-01'
AND sms_fee.id = fee_id  AND fee_subcategory IN ('tuitionA','tuitionB','tuitionC','textbookA', 'textbookB','textbookC', 'facilityA', 'facilityB', 'facilityC');


SELECT sms_transaction.sell_date,due_date FROM `sms_fee`, sms_transaction WHERE sms_transaction.sell_date>'2009-01-31' AND sms_transaction.sell_date<'2009-03-01'
AND due_date<'2009-03-01'
AND sms_fee.id = fee_id  AND fee_subcategory IN ('tuitionA','tuitionB','tuitionC','textbookA', 'textbookB','textbookC', 'facilityA', 'facilityB', 'facilityC');

-- 2009-05-14
DELETE sms_fee FROM sms_fee WHERE salesno IN 
("1000011432","1000011461","1000011482","1000011585","1000011603","1000011604",
"1000011605","1000011606","1000011609","1000011611","1000011612","1000011614",
"1000011615","1000011616","1000011617","1000011619","1000011620","1000011623",
"1000011624","1000011625","1000011625","1000011627","1000011628","1000011629",
"1000011630","1000011631","1000011632","1000011633","1000011635","1000011636",
"1000011637","1000011638","1000011640","1000011641","1000011642","1000011643",
"1000011645","1000011646","1000011647","1000011648","1000011649","1000011650",
"1000011651","1000011652","1000011653","1000011654","1000011656","1000011658",
"1000011658","1000011660","1000011661","1000011662","1000011663","1000011664",
"1000011664","1000011665","1000011666","1000011667","1000011668","1000011669",
"1000011670","1000011671","1000011672","1000011673","1000011674","1000011674",
"1000011675","1000011676","1000011677","1000011678","1000011679","1000011680",
"1000011681","1000011682","1000011683","1000011684","1000011685","1000011687",
"1000011687","1000011689","1000011691","1000011692","1000011693","1000011694",
"1000011698","1000011701","1000011702","1000011703");

DELETE sms_transaction FROM sms_transaction WHERE salesno IN 
("1000011432","1000011461","1000011482","1000011585","1000011603","1000011604",
"1000011605","1000011606","1000011609","1000011611","1000011612","1000011614",
"1000011615","1000011616","1000011617","1000011619","1000011620","1000011623",
"1000011624","1000011625","1000011625","1000011627","1000011628","1000011629",
"1000011630","1000011631","1000011632","1000011633","1000011635","1000011636",
"1000011637","1000011638","1000011640","1000011641","1000011642","1000011643",
"1000011645","1000011646","1000011647","1000011648","1000011649","1000011650",
"1000011651","1000011652","1000011653","1000011654","1000011656","1000011658",
"1000011658","1000011660","1000011661","1000011662","1000011663","1000011664",
"1000011664","1000011665","1000011666","1000011667","1000011668","1000011669",
"1000011670","1000011671","1000011672","1000011673","1000011674","1000011674",
"1000011675","1000011676","1000011677","1000011678","1000011679","1000011680",
"1000011681","1000011682","1000011683","1000011684","1000011685","1000011687",
"1000011687","1000011689","1000011691","1000011692","1000011693","1000011694",
"1000011698","1000011701","1000011702","1000011703");

DELETE sms_salesgroup FROM sms_salesgroup WHERE salesno IN 
("1000011432","1000011461","1000011482","1000011585","1000011603","1000011604",
"1000011605","1000011606","1000011609","1000011611","1000011612","1000011614",
"1000011615","1000011616","1000011617","1000011619","1000011620","1000011623",
"1000011624","1000011625","1000011625","1000011627","1000011628","1000011629",
"1000011630","1000011631","1000011632","1000011633","1000011635","1000011636",
"1000011637","1000011638","1000011640","1000011641","1000011642","1000011643",
"1000011645","1000011646","1000011647","1000011648","1000011649","1000011650",
"1000011651","1000011652","1000011653","1000011654","1000011656","1000011658",
"1000011658","1000011660","1000011661","1000011662","1000011663","1000011664",
"1000011664","1000011665","1000011666","1000011667","1000011668","1000011669",
"1000011670","1000011671","1000011672","1000011673","1000011674","1000011674",
"1000011675","1000011676","1000011677","1000011678","1000011679","1000011680",
"1000011681","1000011682","1000011683","1000011684","1000011685","1000011687",
"1000011687","1000011689","1000011691","1000011692","1000011693","1000011694",
"1000011698","1000011701","1000011702","1000011703");


UPDATE contacts, contact_teacher SET custom_var11='group5' WHERE CONCAT_WS(' ', last_name, first_name) = `name` AND `group` ='5日グループ';
UPDATE contacts, contact_teacher SET custom_var11='group6' WHERE CONCAT_WS(' ', last_name, first_name) = `name` AND `group` ='6日グループ';
UPDATE contacts, contact_teacher SET custom_var11='group7' WHERE CONCAT_WS(' ', last_name, first_name) = `name` AND `group` ='7日グループ';
UPDATE contacts, contact_teacher SET custom_var11='group9' WHERE CONCAT_WS(' ', last_name, first_name) = `name` AND `group` ='9日グループ';


-- 2009-05-29
UPDATE sms_fee SET event_id = '628a783a-7e05-f124-5926-4987e85de7f1' WHERE contact_id = 'c682f08b-d5e6-ea9d-ae3e-4987e83553f0';
UPDATE sms_transaction SET event_id = '628a783a-7e05-f124-5926-4987e85de7f1' WHERE contact_id = 'c682f08b-d5e6-ea9d-ae3e-4987e83553f0';

-- 2009-06-05
UPDATE contacts SET contact_status='3' WHERE contact_status='4';

-- 2009-06-19
UPDATE contacts set custom_var18=idnumber WHERE smsgroup='student';
UPDATE contacts, card SET idnumber = `new` WHERE custom_var18 = `old` AND smsgroup='student';

UPDATE `sms_fee` SET `event_id` = '6b08f7be-c70c-f502-5c3b-4987e8d39741' WHERE CONVERT( `sms_fee`.`id` USING utf8 ) = '9738b5bb-0999-ab50-d36b-49a4c1df781c' LIMIT 1 ;
UPDATE `sms_transaction` SET `event_id` = '6b08f7be-c70c-f502-5c3b-4987e8d39741' WHERE CONVERT( `sms_transaction`.`id` USING utf8 ) = 'ab20cd67-7aad-123c-33d5-49a4e2636b61' LIMIT 1 ;

-- 2009-06-23
SELECT start_date,MONTH( start_date ), DATE(start_date) , DATE_ADD(start_date, INTERVAL (MONTH( start_date )-1) DAY)
FROM `sms_fee`  WHERE DAY(start_date)=1
UPDATE sms_fee SET start_date = DATE_ADD(start_date, INTERVAL (MONTH( start_date )-1) DAY) WHERE DAY(start_date)=1;
UPDATE sms_fee SET start_date = DATE_ADD(start_date, INTERVAL (MONTH( start_date )-2) DAY) WHERE DAY(start_date)=2;
UPDATE sms_fee SET start_date = DATE_ADD(start_date, INTERVAL (MONTH( start_date )-3) DAY) WHERE DAY(start_date)=3;

-- 2009-06-24
UPDATE sms_fee SET event_id = '348dca38-f086-566d-6cf7-4987e814cda1' WHERE salesno IN ('1000011032', '1000011031');
UPDATE sms_transaction SET event_id = '348dca38-f086-566d-6cf7-4987e814cda1' WHERE salesno IN ('1000011032', '1000011031');

-- 2009-11-17
UPDATE contacts SET lead_source = 'other' WHERE lead_source='flier' OR lead_source='hp';

SELECT * FROM `sms_fee` WHERE salesno IN ('1000028341', '1000028354');
SELECT * FROM `sms_transaction` WHERE salesno IN ('1000028341', '1000028354');

-- 2012-09-04
INSERT INTO `resource` (`id`, `school_id`, `date_entered`, `date_modified`, `modified_user_id`, `created_by`, `name`, `shortname`, `description`, `category`, `location`, `deleted`, `capacity`, `resource_attributes`, `common_code`, `activation_key`) VALUES
('nyutai_install_id', 'sssssss-1111', '2011-03-20 08:00:00', '2012-08-16 10:26:36', '1', '1', 'entrance point', 'entrance point', 'entrance point', 'entrance', NULL, 0, 0, '', NULL, 'hiyoshi');

-- 2012-09-12  deleting fee, transaction and invoice data created by gessha koushin wrongly

-- 2009-05-14
DELETE sms_fee FROM sms_fee WHERE salesno IN 
("1000036871","1000036871","1000036656","1000036554","1000036651","1000037103","1000037227","1000036558","1000036564","1000037206","1000036565","1000036567","1000036569","1000036931","1000036571","1000036575","1000036992","1000036577","1000037209","1000037218","1000036666","1000036581","1000036585","1000036587","1000036588","1000036590","1000036592","1000036653","1000036980","1000036594","1000036596","1000036598","1000036655","1000036600","1000037031","1000036604","1000036606","1000036606","1000036609","1000037071","1000036934","1000036613","1000036942","1000036617","1000036619","1000036621","1000036623","1000036625","1000036627","1000036948","1000036630","1000036632","1000036973","1000036636","1000036634","1000036638","1000036639","1000037207","1000036669","1000036641","1000037098","1000036643","1000036645","1000036940","1000036649","1000036964","1000036966","1000036611","1000036662","1000036660","1000036671","1000036675","1000036673","1000037184","1000036682","1000036679","1000037208","1000036688","1000037049","1000036684","1000036686","1000036690","1000036692","1000036694","1000036696","1000036698","1000036702","1000036677","1000036938","1000036969","1000036971","1000036929","1000036706","1000036704","1000036628","1000036708","1000036710","1000036712","1000036714","1000036716","1000036717","1000036607","1000036729","1000036731","1000036733","1000037222","1000037064","1000036615","1000036560","1000036562","1000036722","1000036719","1000036602","1000036647","1000036737","1000036724","1000036913","1000036724","1000036700","1000036739","1000036668","1000036743","1000036741","1000036745","1000036746","1000036750","1000036748","1000036752","1000036753","1000036755","1000036757","1000036952","1000036760","1000036759","1000036762","1000036764","1000036766","1000036944","1000036987","1000036802","1000036806","1000036556","1000036808","1000036946","1000037002","1000036814","1000036810","1000037187","1000037013","1000036797","1000036789","1000036799","1000036793","1000036791","1000036795","1000036997","1000036787","1000036867","1000036867","1000036978","1000036801","1000036996","1000036783","1000036779","1000036785","1000037047","1000036775","1000036725","1000036727","1000036771","1000036769","1000036573","1000036773","1000036573","1000036777","1000036781","1000036982","1000037051","1000036839","1000036837","1000036835","1000037176","1000036552","1000036832","1000036828","1000036830","1000037073","1000037041","1000036826","1000036833","1000036822","1000036925","1000036884","1000037105","1000036882","1000037229","1000037101","1000036824","1000036812","1000036818","1000036816","1000036816","1000036820","1000037224","1000036923","1000037109","1000036986","1000036961","1000036962","1000036977","1000037095","1000036975","1000036957","1000036959","1000036984","1000036989","1000037020","1000037026","1000037006","1000037004","1000037022","1000037015","1000037009","1000037011","1000037008","1000037024","1000037114","1000037033","1000037033","1000037035","1000037213","1000037118","1000036954","1000036954","1000037119","1000036950","1000036950","1000037137","1000037146","1000037128","1000037211","1000036956","1000036956","1000037053","1000037124","1000037130","1000037087","1000037155","1000036915","1000036915","1000037153","1000037085","1000037055","1000037150","1000037058","1000037135","1000037132","1000037141","1000037056","1000037148","1000037152","1000037151","1000037066","1000037060","1000037139","1000037143","1000037069","1000037063","1000037063","1000037154","1000037080","1000037079","1000037067","1000037076","1000037091","1000037074","1000036998","1000037156","1000037084","1000037223","1000037157","1000037158","1000037178","1000037160","1000037159","1000037225","1000037192","1000037170","1000037191","1000037161","1000037193","1000037163","1000037162","1000037194","1000037177","1000037166","1000037203","1000037179","1000037019","1000037019","1000037168","1000037167","1000037180","1000037169","1000037173","1000037175","1000037174","1000036990","1000037215","1000036878","1000037000","1000036886","1000036888","1000036880","1000036967","1000036889","1000036901","1000037096","1000036891","1000036893","1000036895","1000036897","1000037029","1000036899","1000037210","1000036903","1000036906","1000036908","1000037204","1000037220","1000036916","1000036911","1000036909","1000037228","1000036921","1000036919","1000036876","1000037212","1000036681","1000036681","1000036861","1000037214","1000036865","1000036874","1000036869","1000037099","1000037217","1000037216","1000036863","1000036847","1000036849","1000036858","1000036856","1000036926","1000036854","1000036659","1000036853","1000036659","1000036664","1000036583","1000037016","1000037094","1000036851","1000036841","1000037107","1000036843","1000036999","1000036844","1000037188","1000037182","1000037183","1000037185","1000037199","1000037090","1000037090","1000037195","1000037196","1000037202","1000037197","1000037172","1000037181","1000037226","1000037201","1000037200","1000037189","1000037112","1000037205","1000037221");

DELETE sms_transaction FROM sms_transaction WHERE salesno IN 
("1000036871","1000036871","1000036656","1000036554","1000036651","1000037103","1000037227","1000036558","1000036564","1000037206","1000036565","1000036567","1000036569","1000036931","1000036571","1000036575","1000036992","1000036577","1000037209","1000037218","1000036666","1000036581","1000036585","1000036587","1000036588","1000036590","1000036592","1000036653","1000036980","1000036594","1000036596","1000036598","1000036655","1000036600","1000037031","1000036604","1000036606","1000036606","1000036609","1000037071","1000036934","1000036613","1000036942","1000036617","1000036619","1000036621","1000036623","1000036625","1000036627","1000036948","1000036630","1000036632","1000036973","1000036636","1000036634","1000036638","1000036639","1000037207","1000036669","1000036641","1000037098","1000036643","1000036645","1000036940","1000036649","1000036964","1000036966","1000036611","1000036662","1000036660","1000036671","1000036675","1000036673","1000037184","1000036682","1000036679","1000037208","1000036688","1000037049","1000036684","1000036686","1000036690","1000036692","1000036694","1000036696","1000036698","1000036702","1000036677","1000036938","1000036969","1000036971","1000036929","1000036706","1000036704","1000036628","1000036708","1000036710","1000036712","1000036714","1000036716","1000036717","1000036607","1000036729","1000036731","1000036733","1000037222","1000037064","1000036615","1000036560","1000036562","1000036722","1000036719","1000036602","1000036647","1000036737","1000036724","1000036913","1000036724","1000036700","1000036739","1000036668","1000036743","1000036741","1000036745","1000036746","1000036750","1000036748","1000036752","1000036753","1000036755","1000036757","1000036952","1000036760","1000036759","1000036762","1000036764","1000036766","1000036944","1000036987","1000036802","1000036806","1000036556","1000036808","1000036946","1000037002","1000036814","1000036810","1000037187","1000037013","1000036797","1000036789","1000036799","1000036793","1000036791","1000036795","1000036997","1000036787","1000036867","1000036867","1000036978","1000036801","1000036996","1000036783","1000036779","1000036785","1000037047","1000036775","1000036725","1000036727","1000036771","1000036769","1000036573","1000036773","1000036573","1000036777","1000036781","1000036982","1000037051","1000036839","1000036837","1000036835","1000037176","1000036552","1000036832","1000036828","1000036830","1000037073","1000037041","1000036826","1000036833","1000036822","1000036925","1000036884","1000037105","1000036882","1000037229","1000037101","1000036824","1000036812","1000036818","1000036816","1000036816","1000036820","1000037224","1000036923","1000037109","1000036986","1000036961","1000036962","1000036977","1000037095","1000036975","1000036957","1000036959","1000036984","1000036989","1000037020","1000037026","1000037006","1000037004","1000037022","1000037015","1000037009","1000037011","1000037008","1000037024","1000037114","1000037033","1000037033","1000037035","1000037213","1000037118","1000036954","1000036954","1000037119","1000036950","1000036950","1000037137","1000037146","1000037128","1000037211","1000036956","1000036956","1000037053","1000037124","1000037130","1000037087","1000037155","1000036915","1000036915","1000037153","1000037085","1000037055","1000037150","1000037058","1000037135","1000037132","1000037141","1000037056","1000037148","1000037152","1000037151","1000037066","1000037060","1000037139","1000037143","1000037069","1000037063","1000037063","1000037154","1000037080","1000037079","1000037067","1000037076","1000037091","1000037074","1000036998","1000037156","1000037084","1000037223","1000037157","1000037158","1000037178","1000037160","1000037159","1000037225","1000037192","1000037170","1000037191","1000037161","1000037193","1000037163","1000037162","1000037194","1000037177","1000037166","1000037203","1000037179","1000037019","1000037019","1000037168","1000037167","1000037180","1000037169","1000037173","1000037175","1000037174","1000036990","1000037215","1000036878","1000037000","1000036886","1000036888","1000036880","1000036967","1000036889","1000036901","1000037096","1000036891","1000036893","1000036895","1000036897","1000037029","1000036899","1000037210","1000036903","1000036906","1000036908","1000037204","1000037220","1000036916","1000036911","1000036909","1000037228","1000036921","1000036919","1000036876","1000037212","1000036681","1000036681","1000036861","1000037214","1000036865","1000036874","1000036869","1000037099","1000037217","1000037216","1000036863","1000036847","1000036849","1000036858","1000036856","1000036926","1000036854","1000036659","1000036853","1000036659","1000036664","1000036583","1000037016","1000037094","1000036851","1000036841","1000037107","1000036843","1000036999","1000036844","1000037188","1000037182","1000037183","1000037185","1000037199","1000037090","1000037090","1000037195","1000037196","1000037202","1000037197","1000037172","1000037181","1000037226","1000037201","1000037200","1000037189","1000037112","1000037205","1000037221");

DELETE sms_salesgroup FROM sms_salesgroup WHERE salesno IN 
("1000036871","1000036871","1000036656","1000036554","1000036651","1000037103","1000037227","1000036558","1000036564","1000037206","1000036565","1000036567","1000036569","1000036931","1000036571","1000036575","1000036992","1000036577","1000037209","1000037218","1000036666","1000036581","1000036585","1000036587","1000036588","1000036590","1000036592","1000036653","1000036980","1000036594","1000036596","1000036598","1000036655","1000036600","1000037031","1000036604","1000036606","1000036606","1000036609","1000037071","1000036934","1000036613","1000036942","1000036617","1000036619","1000036621","1000036623","1000036625","1000036627","1000036948","1000036630","1000036632","1000036973","1000036636","1000036634","1000036638","1000036639","1000037207","1000036669","1000036641","1000037098","1000036643","1000036645","1000036940","1000036649","1000036964","1000036966","1000036611","1000036662","1000036660","1000036671","1000036675","1000036673","1000037184","1000036682","1000036679","1000037208","1000036688","1000037049","1000036684","1000036686","1000036690","1000036692","1000036694","1000036696","1000036698","1000036702","1000036677","1000036938","1000036969","1000036971","1000036929","1000036706","1000036704","1000036628","1000036708","1000036710","1000036712","1000036714","1000036716","1000036717","1000036607","1000036729","1000036731","1000036733","1000037222","1000037064","1000036615","1000036560","1000036562","1000036722","1000036719","1000036602","1000036647","1000036737","1000036724","1000036913","1000036724","1000036700","1000036739","1000036668","1000036743","1000036741","1000036745","1000036746","1000036750","1000036748","1000036752","1000036753","1000036755","1000036757","1000036952","1000036760","1000036759","1000036762","1000036764","1000036766","1000036944","1000036987","1000036802","1000036806","1000036556","1000036808","1000036946","1000037002","1000036814","1000036810","1000037187","1000037013","1000036797","1000036789","1000036799","1000036793","1000036791","1000036795","1000036997","1000036787","1000036867","1000036867","1000036978","1000036801","1000036996","1000036783","1000036779","1000036785","1000037047","1000036775","1000036725","1000036727","1000036771","1000036769","1000036573","1000036773","1000036573","1000036777","1000036781","1000036982","1000037051","1000036839","1000036837","1000036835","1000037176","1000036552","1000036832","1000036828","1000036830","1000037073","1000037041","1000036826","1000036833","1000036822","1000036925","1000036884","1000037105","1000036882","1000037229","1000037101","1000036824","1000036812","1000036818","1000036816","1000036816","1000036820","1000037224","1000036923","1000037109","1000036986","1000036961","1000036962","1000036977","1000037095","1000036975","1000036957","1000036959","1000036984","1000036989","1000037020","1000037026","1000037006","1000037004","1000037022","1000037015","1000037009","1000037011","1000037008","1000037024","1000037114","1000037033","1000037033","1000037035","1000037213","1000037118","1000036954","1000036954","1000037119","1000036950","1000036950","1000037137","1000037146","1000037128","1000037211","1000036956","1000036956","1000037053","1000037124","1000037130","1000037087","1000037155","1000036915","1000036915","1000037153","1000037085","1000037055","1000037150","1000037058","1000037135","1000037132","1000037141","1000037056","1000037148","1000037152","1000037151","1000037066","1000037060","1000037139","1000037143","1000037069","1000037063","1000037063","1000037154","1000037080","1000037079","1000037067","1000037076","1000037091","1000037074","1000036998","1000037156","1000037084","1000037223","1000037157","1000037158","1000037178","1000037160","1000037159","1000037225","1000037192","1000037170","1000037191","1000037161","1000037193","1000037163","1000037162","1000037194","1000037177","1000037166","1000037203","1000037179","1000037019","1000037019","1000037168","1000037167","1000037180","1000037169","1000037173","1000037175","1000037174","1000036990","1000037215","1000036878","1000037000","1000036886","1000036888","1000036880","1000036967","1000036889","1000036901","1000037096","1000036891","1000036893","1000036895","1000036897","1000037029","1000036899","1000037210","1000036903","1000036906","1000036908","1000037204","1000037220","1000036916","1000036911","1000036909","1000037228","1000036921","1000036919","1000036876","1000037212","1000036681","1000036681","1000036861","1000037214","1000036865","1000036874","1000036869","1000037099","1000037217","1000037216","1000036863","1000036847","1000036849","1000036858","1000036856","1000036926","1000036854","1000036659","1000036853","1000036659","1000036664","1000036583","1000037016","1000037094","1000036851","1000036841","1000037107","1000036843","1000036999","1000036844","1000037188","1000037182","1000037183","1000037185","1000037199","1000037090","1000037090","1000037195","1000037196","1000037202","1000037197","1000037172","1000037181","1000037226","1000037201","1000037200","1000037189","1000037112","1000037205","1000037221");

