Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.NetClientPreviousEmployees ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> create procedure "pears"."NetClientPreviousEmployees"( in "pWebUserID" char(20) ) result( "Name" char(100),"PersonID" char(20),"KeyName" char(100) ) begin declare local temporary table "Cos"( "CompanyID" char(20) null, ) not transactional; -- Get all the Companies the WebUser is Associated with declare local temporary table "Pes"( "PersonID" char(20) null, ) not transactional;insert into "Cos"( "CompanyID" ) select "companyid" from "employment" key join "iqxnetuserlink" where "iqxnetuserid" = "pWebUserID"; -- Get all the People who have worked in the period for those Companies insert into "Pes"( "PersonID" ) select distinct "e"."personid" from "employment" as "e" key join "placement" ,"employment" as "e" join "Cos" on "e"."CompanyID" = "Cos"."CompanyID" where not "e"."personid" = any(select "personid" from "employment" where "companyid" = "e"."companyid" and "noreemploy" = 1) and "e"."startdate" >= "IQXNetCompanyStartDate"("e"."companyid"); -- Get the Peoples details select "person"."name","person"."personid","person"."keyname" from "person" join "PES" on "Pes"."PersonID" = "Person"."PersonID" order by "person"."keyname" asc end go COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetClientPreviousEmployees" IS {create procedure pears."NetClientPreviousEmployees"( in "pWebUserID" char(20) ) result( "Name" char(100),"PersonID" char(20),"KeyName" char(100) ) begin declare local temporary table "Cos"( "CompanyID" char(20) null, ) not transactional; -- Get all the Companies the WebUser is Associated with declare local temporary table "Pes"( "PersonID" char(20) null, ) not transactional;insert into "Cos"( "CompanyID" ) select "companyid" from "employment" key join "iqxnetuserlink" where "iqxnetuserid" = "pWebUserID"; -- Get all the People who have worked in the period for those Companies insert into "Pes"( "PersonID" ) select distinct "e"."personid" from "employment" as "e" key join "placement" ,"employment" as "e" join "Cos" on "e"."CompanyID" = "Cos"."CompanyID" where not "e"."personid" = any(select "personid" from "employment" where "companyid" = "e"."companyid" and "noreemploy" = 1) and "e"."startdate" >= "IQXNetCompanyStartDate"("e"."companyid"); -- Get the Peoples details select "person"."name","person"."personid","person"."keyname" from "person" join "PES" on "Pes"."PersonID" = "Person"."PersonID" order by "person"."keyname" asc end } </code> database/procedures/pears_netclientpreviousemployees.txt Last modified: 2026/08/07 19:24by 127.0.0.1