====== pears.NetCandidateGetJobsAppliedFor ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create procedure "pears"."NetCandidateGetJobsAppliedFor"( in "pWebUserID" char(20) ) result( "progressid" char(20),"vacancyid" char(20),"refcode" char(20),"position" char(50),"department" char(30),"name" char(60),"InterviewDate" date,"InterviewTime" time,"startdate" date,"FinishDate" date,"rejectionreason" char(100),"notes" long varchar,"staff" char(60),"email" char(100),"entrydate" date,"dateapplied" date,"vacancystatus" char(1) ) // IQXWeb begin select "p"."progressid", "v"."vacancyid", "v"."refcode", "v"."position", (select "name" from "department" where "department"."departmentid" = "v"."departmentid"), "s"."name", "p"."InterviewDate", "p"."InterviewTime", "v"."startdate", "v"."FinishDate", "p"."rejectionreason", "v"."notes", "u"."name" as "staff", "u"."email", "v"."entrydate", (select first "HistoryDate" from "progresshistory" where "progresshistory"."ProgressID" = "p"."ProgressID" order by "HistoryDate" asc) as "dateapplied", "v"."status" as "vacancystatus" from "progress" as "p" key join "vacancy" as "v" key join("department" as "d","staff" as "u") ,"progress" as "p" join "status" as "s" on "s"."type" = 'r' and "s"."status" = "p"."status" where "p"."personid" = any(select "personid" from "iqxnetuserlink" where "iqxnetuserid" = "pwebuserid") order by "dateapplied" asc end /* DOC 3/2/2020 AW initialise */ /* TEST */ go COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetCandidateGetJobsAppliedFor" IS {create PROCEDURE pears."NetCandidateGetJobsAppliedFor"(in pWebUserID char(20)) RESULT(progressid char(20), vacancyid char(20), refcode char(20), position char(50), department char(30), name char(60), InterviewDate date, InterviewTime time, startdate date, FinishDate date, rejectionreason char(100), notes long varchar, staff char(60), email char(100), entrydate date, dateapplied date, vacancystatus char(1) ) // IQXWeb begin SELECT p.progressid, v.vacancyid, v.refcode, v.position, (SELECT name FROM department WHERE department.departmentid = v.departmentid ), s.name, p.InterviewDate, p.InterviewTime, v.startdate, v.FinishDate, p.rejectionreason, v.notes, u.name as staff, u.email, v.entrydate, (SELECT FIRST HistoryDate FROM progresshistory WHERE progresshistory.ProgressID = p.ProgressID ORDER BY HistoryDate) as dateapplied, v.status as vacancystatus FROM progress as p KEY JOIN vacancy as v KEY JOIN (department as d, staff as u), progress as p JOIN status as s ON s.type='r' AND s.status=p.status WHERE p.personid in (select personid from iqxnetuserlink where iqxnetuserid = pwebuserid) ORDER BY dateapplied end /* DOC 3/2/2020 AW initialise */ /* TEST */ }