Queries used to merge spc_user and contact table data UPDATE spc_users SET contact_id = 13, org_job_title = 'Operations Manager 1', spc_contact = 'Y' WHERE peo_id = 1; UPDATE spc_users SET contact_id = 4814, org_job_title = 'Technology Director', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 4; user_id 3 has 2 different names UPDATE spc_users SET contact_id = 4760, buildings_id = 267, org_job_title = 'Business Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 8; UPDATE spc_users SET contact_id = 1482, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 9; UPDATE spc_users SET contact_id = 566, buildings_id = 183, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 10; UPDATE spc_users SET contact_id = 2126, buildings_id = 549, org_job_title = 'CIO', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 13; UPDATE spc_users SET contact_id = 4780, buildings_id = 549, org_job_title = 'IT Director', spc_contact = 'Y' WHERE peo_id = 15; UPDATE spc_users SET contact_id = 4782, buildings_id = 613, org_job_title = 'Business Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 17; UPDATE spc_users SET contact_id = 4661, org_job_title = 'Superintendent', spc_contact = 'Y', email_group_id = 5 WHERE peo_id = 19; UPDATE spc_users SET contact_id = 4769, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 20; UPDATE spc_users SET contact_id = 4804, buildings_id = 363, org_job_title = 'Business Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 22; UPDATE spc_users SET contact_id = 4830, buildings_id = 491, org_job_title = 'Superintendent', spc_contact = 'Y', email_group_id = 5 WHERE peo_id = 31; UPDATE spc_users SET contact_id = 4781, buildings_id = 314, org_job_title = 'IT Manager', spc_contact = 'Y', notes = '
2/27/15 Kyle Luce No longer employed by district PER Debbie Oconnor New IT Mgr. is Trey Aldridge.
', email_group_id = 1 WHERE peo_id = 32; UPDATE spc_users SET contact_id = 2073, spc_contact = 'Y' WHERE peo_id = 34; UPDATE spc_users SET contact_id = 4697, org_job_title = 'Superintendent', spc_contact = 'Y', notes = 'Replaced Dan French; 7/2020 replaced Jackie Wilson', email_group_id = 5 WHERE peo_id = 35; UPDATE spc_users SET contact_id = 4695, org_job_title = 'Business Manager', spc_contact = 'Y', notes = 'Sue also handles Accounts Payable.', email_group_id = 2 WHERE peo_id = 36; UPDATE spc_users SET contact_id = 4812, org_job_title = 'Facilities Director', spc_contact = 'Y' WHERE peo_id = 39; UPDATE spc_users SET contact_id = 4772, org_job_title = 'Business Manager', spc_contact = 'Y', notes = '
Formerly Linda Casey
', email_group_id = 2 WHERE peo_id = 50; UPDATE spc_users SET contact_id = 2804, org_job_title = 'Superintendent', spc_contact = 'Y', email_group_id = 5 WHERE peo_id = 51; UPDATE spc_users SET contact_id = 4771, org_job_title = 'IT Operations Manager', spc_contact = 'Y' WHERE peo_id = 63; UPDATE spc_users SET contact_id = 4770, org_job_title = 'IT Director', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 68; UPDATE spc_users SET contact_id = 4740, org_job_title = 'Superintendent', spc_contact = 'Y', email_group_id = 5 WHERE peo_id = 69; UPDATE spc_users SET contact_id = 4647, org_job_title = 'Finance Director', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 74; UPDATE spc_users SET contact_id = 4819, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 108; UPDATE spc_users SET contact_id = 4663, org_job_title = 'Assistant to Superintendant', spc_contact = 'Y', email_group_id = 5 WHERE peo_id = 111; UPDATE spc_users SET contact_id = 4705, org_job_title = 'IT Support', spc_contact = 'Y' WHERE peo_id = 121; UPDATE spc_users SET contact_id = 4829, buildings_id = 475, org_job_title = 'Superintendent', spc_contact = 'Y', email_group_id = 5 WHERE peo_id = 142; UPDATE spc_users SET contact_id = 4741, buildings_id = 183, org_job_title = 'IT Technician', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 147; UPDATE spc_users SET contact_id = 4824, org_job_title = 'Business Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 181; UPDATE spc_users SET contact_id = 4649, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 183; UPDATE spc_users SET contact_id = 4777, org_job_title = 'Business Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 190; UPDATE spc_users SET contact_id = 1158, org_job_title = 'Admin Assistant', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 201; UPDATE spc_users SET contact_id = 4110, org_job_title = 'Transportation Director', spc_contact = 'Y' WHERE peo_id = 251; UPDATE spc_users SET contact_id = 4806, buildings_id = 379, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 23; UPDATE spc_users SET contact_id = 4746, buildings_id = 207, org_job_title = 'Business Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 24; UPDATE spc_users SET contact_id = 4744, buildings_id = 207, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 25; UPDATE spc_users SET contact_id = 4899, buildings_id = 5, org_job_title = 'Business Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 26; UPDATE spc_users SET contact_id = 4802, buildings_id = 1223, org_job_title = 'Executive Vice Presdient', spc_contact = 'Y' WHERE peo_id = 37; UPDATE spc_users SET contact_id = 4738, buildings_id = 545, org_job_title = 'IT Technician', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 38; UPDATE spc_users SET contact_id = 4707, buildings_id = 63, org_job_title = 'IT Director', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 11; UPDATE spc_users SET contact_id = 4786, buildings_id = 318, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 16; UPDATE spc_users SET contact_id = 4803, buildings_id = 363, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 21; UPDATE spc_users SET contact_id = 4855, buildings_id = 578, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 44; UPDATE spc_users SET contact_id = 2123, buildings_id = 5, org_job_title = 'Superintendent', spc_contact = 'Y', email_group_id = 5 WHERE peo_id = 89; UPDATE spc_users SET contact_id = 4752, buildings_id = 249, org_job_title = 'IT Director', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 97; UPDATE spc_users SET contact_id = 4833, buildings_id = 586, org_job_title = 'Business Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 99; UPDATE spc_users SET contact_id = 4808, buildings_id = 379, org_job_title = 'Superintendent', spc_contact = 'Y' WHERE peo_id = 100; UPDATE spc_users SET contact_id = 4731, buildings_id = 163, org_job_title = 'Town Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 109; UPDATE spc_users SET contact_id = 4662, buildings_id = 507, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 110; UPDATE spc_users SET contact_id = 4745, buildings_id = 207, org_job_title = 'IT Support', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 122; UPDATE spc_users SET contact_id = 2, buildings_id = 1208, org_job_title = 'IT Director', spc_contact = 'Y', email_group_id = 7 WHERE peo_id = 126; UPDATE spc_users SET contact_id = 4839, buildings_id = 1180, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 133; UPDATE spc_users SET contact_id = 4729, buildings_id = 153, org_job_title = 'Town Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 135; UPDATE spc_users SET contact_id = 4811, buildings_id = 402, org_job_title = 'Safety & Security Support', spc_contact = 'Y' WHERE peo_id = 173; UPDATE spc_users SET contact_id = 113, buildings_id = 450, org_job_title = 'Business & Operations Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 185; UPDATE spc_users SET contact_id = 22, buildings_id = 36, org_job_title = 'Business Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 191; UPDATE spc_users SET contact_id = 391, buildings_id = 33, org_job_title = 'IT Technician', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 192; UPDATE spc_users SET contact_id = 4711, buildings_id = 89, org_job_title = 'Contract IT', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 197; UPDATE spc_users SET contact_id = 4713, buildings_id = 89, org_job_title = 'Town Manager', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 198; UPDATE spc_users SET contact_id = 2258, buildings_id = 89, org_job_title = 'Deputy Finance Director', spc_contact = 'Y', email_group_id = 3 WHERE peo_id = 199; UPDATE spc_users SET contact_id = 185, buildings_id = 143, org_job_title = 'Business Manager', spc_contact = 'Y', email_group_id = 3 WHERE peo_id = 203; UPDATE spc_users SET contact_id = 4735, buildings_id = 592, org_job_title = 'IT Manager', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 204; UPDATE spc_users SET contact_id = 4733, buildings_id = 592, org_job_title = 'Principal', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 205; UPDATE spc_users SET contact_id = 124, buildings_id = 318, org_job_title = 'Superintendent', spc_contact = 'Y', email_group_id = 5 WHERE peo_id = 264; UPDATE spc_users SET contact_id = 4785, buildings_id = 1389, org_job_title = 'IT Director', spc_contact = 'Y', email_group_id = 1 WHERE peo_id = 288; UPDATE spc_users SET contact_id = 4784, buildings_id = 1389, org_job_title = 'Business Administrator', spc_contact = 'Y', email_group_id = 2 WHERE peo_id = 289; UPDATE spc_users SET contact_id = 9, buildings_id = 550, org_job_title = 'President', spc_contact = 'Y' WHERE peo_id = 27; DELETE FROM spc_users WHERE peo_id = 567; /*Cherly Gould*/ UPDATE spc_users SET email = 'rwhitcomb@mymtsd-vt.org' WHERE peo_id = 38; DELETE FROM spc_users WHERE peo_id = 1404; /*Robert Whitcomb */ DELETE FROM spc_users WHERE peo_id = 52; /* Kathy Cuddy-Egbert */ DELETE FROM spc_users WHERE peo_id IN(83, 1539); /* Mike Feero and Tim Larson */ DELETE FROM spc_users WHERE peo_id = 193; /* Josh Young */ DELETE FROM spc_users WHERE peo_id IN(196, 608); /* Heather Austin and Kelly King */ DELETE FROM spc_users WHERE peo_id = 261; /* Dianne Helprin */ UPDATE spc_users SET user_id = NULL WHERE peo_id = 1417; DELETE FROM spc_users WHERE peo_id = 159; /*Duane Ford's second user_id 0f 743*/ UPDATE spc_users SET notes = 'Duane Ford has 2 peo_ids because he is the contact for orgs 1781 and 59.' WHERE peo_id IN(190, 1537); UPDATE spc_users SET notes = 'Peter Mullen is also a contact for building 399' WHERE peo_id IN(6); UPDATE spc_users SET contact_id = 4810, org_job_title = 'Technology Specialist', spc_contact = 'Y', notes = 'Peter Mullen is also a contact for building 399' WHERE peo_id = 6; DELETE FROM spc_users WHERE peo_id = 1472; /*Peter Mullen*/ #UPDATE spc_users SET notes = 'Buildings - all locations' WHERE notes is null and buildings_id = 549; UPDATE spc_users SET buildings_id = NULL WHERE buildings_id = 549 AND notes LIKE('Buildings - all locations%'); /*DELETE FROM spc_users WHERE peo_id IN(569, 570, 1476, 1426, 1161, 736, 1379, 1264, 1443, 1449, 1445, 1352, 1434, 1465, 1468, 1412, 1410, 1538, 1466, 1491, 1444, 1262, 1370, 1368, 1464, 1474, 1513, 1437, 1278, 1436, 1435, 1406, 1349, 1263, 1418, 1494, 1470, 1480, 1397, 1353, 1354, 1377, 1411, 568, 1500, 1395, 1490, 1407, 1473, 1485, 1350, 586, 1441, 573, 661, 1383, 1384, 639, 1011, 606, 1401, 1399, 1312, 591, 1448, 1447);*/ select * from spc_users where peo_id NOT IN(569, 570, 1476, 1426, 1161, 736, 1264, 1443, 1445, 1352, 1434, 1466, 1491, 1444, 1262, 1370, 1368, 1474, 1437, 1278, 1436, 1435, 1406, 1349, 1480, 1354, 1490, 1407, 1485, 1350, 1441, 1011, 1312) AND user_id IN(select user_id from spc_users group by user_id having count(user_id) > 1) ORDER BY user_id; SELECT peo_id, user_id, contact_id, first_name, last_name, organizations_id, buildings_id, notes, email FROM spc_users; SELECT * FROM buildings WHERE bldg_id IN(399, 612, 549, 63, 363, 207, 5, 1223, 545, 578, 249, 586, 379, 163, 507, 1208, 1180, 153, 402, 450, 33, 36); UPDATE spc_users SET notes = 'Buildings - all locations' WHERE buildings_id = 549;