--	RE-1289 : Advanced Reports
--
-- Dumping data for table `report_maker`
--
-- WHERE:  deleted = 0 AND (name like '%Accounts%' OR name like '%Segments%')

INSERT INTO `report_maker` VALUES ('1','1','c3186a94-cbd1-11ea-a4a0-068f35089d4a',0,'2020-07-22 04:13:56','2020-07-22 04:31:57','26402598-50be-ec49-1490-51028469b0e9','26402598-50be-ec49-1490-51028469b0e9','Accounts FS Report',NULL,'left',NULL,0,NULL);
INSERT INTO `report_maker` VALUES ('6c2b1c6d-3d42-c8c7-4c83-53715f7c2b48','6c2b1c6d-3d42-c8c7-4c83-53715f7c2b48','df063ae4-cbe8-11ea-8b25-068f35089d4a',0,'2020-07-22 06:59:21','2020-07-22 13:42:28','26402598-50be-ec49-1490-51028469b0e9','56b26ecb-8bda-3fbd-00d6-50c9af4ac5a5','Segments FS Report',NULL,'left',NULL,0,NULL);

--
-- Dumping data for table `custom_queries`
--
-- WHERE:  deleted = 0 AND (name like '%Accounts%' OR name like '%Segments%')

INSERT INTO `custom_queries` VALUES ('1','1','252c9ba6-cbd2-11ea-8672-068f35089d4a',0,'2020-07-22 04:16:38','2020-07-22 04:16:38','26402598-50be-ec49-1490-51028469b0e9','26402598-50be-ec49-1490-51028469b0e9','Accounts - Mismatched Account FS Contacts Count',NULL,'SELECT  a.name as \"Account Name\", count(ac_c.contact_id) AS \"Mismatched Account FS Count\" FROM  contacts_cstm cs, accounts_contacts ac_c, accounts_cstm ac, contacts c, accounts a WHERE  a.id = ac.id_c AND a.id = ac_c.account_id AND cs.id_c = ac_c.contact_id AND cs.id_c = c.id AND ac_c.primary_account=1 AND a.deleted=0 AND  ac_c.deleted=0 AND c.deleted = 0 AND cs.feature_switches_account_c != ac.feature_switches_account_c GROUP BY\r\na.id HAVING count(ac_c.contact_id) > 0 ORDER BY a.name;',NULL,NULL,'',NULL);
INSERT INTO `custom_queries` VALUES ('1','1','3ed4e4f8-cbcf-11ea-ae51-068f35089d4a',0,'2020-07-22 03:55:54','2020-07-22 04:14:37','26402598-50be-ec49-1490-51028469b0e9','26402598-50be-ec49-1490-51028469b0e9','Segments - Mismatched FS Contacts Count',NULL,'SELECT  s.name AS \"Segment Name\", COUNT(s_c.se_segment_contacts_1contacts_idb) \"Mismatched Segment FS Count\" FROM se_segment s, se_segment_contacts_1_c s_c,  contacts_cstm c_cstm,  contacts c, se_segment_cstm s_cstm WHERE s.id = s_c.se_segment_contacts_1se_segment_ida AND s.id = s_cstm.id_c AND s_c.se_segment_contacts_1se_segment_ida = s_cstm.id_c AND s_c.se_segment_contacts_1contacts_idb = c.id AND s_c.deleted=0 AND c.deleted = 0 AND c.id = c_cstm.id_c AND ( s_cstm.profile_prompts_segment_c != c_cstm.defaultprofile_prompts_count_c OR s_cstm.steps_c_segment_c != c_cstm.steps_c_default_c OR s_cstm.feature_switches_segment_c != c_cstm.feature_switches_segment_c) GROUP BY s_c.se_segment_contacts_1se_segment_ida HAVING COUNT(s_c.se_segment_contacts_1contacts_idb) > 0 ORDER BY s.name ASC;',NULL,NULL,'',NULL);
INSERT INTO `custom_queries` VALUES ('1','1','4b114fce-cbd2-11ea-b301-068f35089d4a',0,'2020-07-22 04:17:44','2020-07-22 04:17:44','26402598-50be-ec49-1490-51028469b0e9','26402598-50be-ec49-1490-51028469b0e9','Accounts - All Related Contacts',NULL,'SELECT  a.name as \"Account Name\", count(ac_c.contact_id) AS \"All Related Contacts Count\" FROM  contacts_cstm cs, accounts_contacts ac_c, accounts_cstm ac, contacts c, accounts a WHERE  a.id = ac.id_c AND a.id = ac_c.account_id AND cs.id_c = ac_c.contact_id AND cs.id_c = c.id AND ac_c.primary_account=1 AND a.deleted=0 AND  ac_c.deleted=0 AND c.deleted = 0 GROUP BY a.id HAVING count(ac_c.contact_id) > 0 ORDER BY a.name;',NULL,NULL,'',NULL);
INSERT INTO `custom_queries` VALUES ('1','1','f02d08ac-cbcf-11ea-94ad-068f35089d4a',0,'2020-07-22 04:00:53','2020-07-22 04:03:58','26402598-50be-ec49-1490-51028469b0e9','26402598-50be-ec49-1490-51028469b0e9','Segments - All Related Contacts',NULL,'select s.name AS \"Segment Name\", count(se_segment_contacts_1contacts_idb) AS \"Count Related Contacts\"  FROM se_segment_contacts_1_c, se_segment s WHERE s.id = se_segment_contacts_1_c.se_segment_contacts_1se_segment_ida AND s.deleted =0 AND se_segment_contacts_1_c.deleted = 0 AND se_segment_contacts_1contacts_idb IN (select id from contacts WHERE deleted = 0) GROUP BY se_segment_contacts_1se_segment_ida HAVING count(se_segment_contacts_1contacts_idb) >0 ORDER BY s.name ASC;',NULL,NULL,'',NULL);

--
-- Dumping data for table `data_sets`
--
-- WHERE:  deleted = 0 AND (name like '%Accounts%' OR name like '%Segments%')

INSERT INTO `data_sets` VALUES ('1','1','14261abe-cbe9-11ea-a398-068f35089d4a',0,'2020-07-22 07:00:51','2020-07-22 07:02:05','56b26ecb-8bda-3fbd-00d6-50c9af4ac5a5','56b26ecb-8bda-3fbd-00d6-50c9af4ac5a5',NULL,'df063ae4-cbe8-11ea-8b25-068f35089d4a','f02d08ac-cbcf-11ea-94ad-068f35089d4a','Segments FS All',0,'','1',NULL,'100','Default',NULL,'','',NULL,NULL,NULL,NULL,'%',NULL,NULL);
INSERT INTO `data_sets` VALUES ('1','1','29876cbe-cbe9-11ea-9a42-068f35089d4a',0,'2020-07-22 07:01:26','2020-07-22 07:03:20','56b26ecb-8bda-3fbd-00d6-50c9af4ac5a5','56b26ecb-8bda-3fbd-00d6-50c9af4ac5a5',NULL,'df063ae4-cbe8-11ea-8b25-068f35089d4a','3ed4e4f8-cbcf-11ea-ae51-068f35089d4a','Segments FS mismatched',1,'','1',NULL,'100','Default',NULL,'1','1',NULL,NULL,NULL,'red','%',NULL,NULL);
INSERT INTO `data_sets` VALUES ('1','1','7be70fee-cbd2-11ea-8176-068f35089d4a',0,'2020-07-22 04:19:06','2020-07-22 13:46:13','26402598-50be-ec49-1490-51028469b0e9','26402598-50be-ec49-1490-51028469b0e9',NULL,'c3186a94-cbd1-11ea-a4a0-068f35089d4a','4b114fce-cbd2-11ea-b301-068f35089d4a','Accounts - FS All',0,'1','1',NULL,'100','Default',NULL,'','',NULL,NULL,NULL,NULL,'%',NULL,NULL);
INSERT INTO `data_sets` VALUES ('1','1','a37ecca4-cbd2-11ea-88b1-068f35089d4a',0,'2020-07-22 04:20:13','2020-07-22 13:46:31','26402598-50be-ec49-1490-51028469b0e9','26402598-50be-ec49-1490-51028469b0e9',NULL,'c3186a94-cbd1-11ea-a4a0-068f35089d4a','252c9ba6-cbd2-11ea-8672-068f35089d4a','Accounts - FS Mismatched',1,'1','1',NULL,'100','Default',NULL,'','',NULL,NULL,NULL,'red','%',NULL,NULL);
