Find access level removals from Netboxes

Find API user personid,then:


\copy (select p.id, p.text6, p.firstname, p.lastname, s2g.name AS acccesslevel,ptalgh.lastmod FROM person p JOIN s2activity.person_to_accesslevel_group_history ptalgh ON p.id=ptalgh.personid JOIN s2group s2g ON s2g.id=ptalgh.accesslevel_groupid WHERE ptalgh.deleted='t' and ptalgh.lastmodpersonid=(API personid) order by ptalgh.lastmod desc) to 'export.csv' with (format csv, header);