Hello,
I have written a simple query to generate appraisal details for Department members it is as follows.
select distinct
DP.DepartmentReference Reference,
DP.DepartmentName Name,
(select count(DM.PersonKey)DepartmentMembers from DepartmentMembershi DM
where DM.DepartmentKey = DP.DepartmentKey),
(select
count(DM.PersonKey) Appraised
from DepartmentMembershi DM,Appraisal AP
where
DM.DepartmentKey = DP.DepartmentKey and
DM.PersonKey = AP.PersonKeyAppraisee and
AP.AppraisalDate > (select
BP.StartDate
from
BudgetingPeriod BP
where BP.StartDate < CURDATE ( ) and BP.EndDate >= CURDATE ( )
and BP.Subcode = '') and
AP.AppraisalDate <= (select
BP.EndDate
from
BudgetingPeriod BP
where BP.StartDate < CURDATE ( ) and BP.EndDate >= CURDATE ( )
and BP.Subcode = '')
and AP.AppraisalStatus ='ACTU'
and AP.AppraisalType = 'ANNL'),
PD.DepartmentReference DeptAbove
from
Department DP
Left Outer Join Department PD
on
DP.DepartmentKeyDepar = PD.DepartmentKey
As you can see I only require Appraisal that occur in the current budged period. Can I assign the start and end dates of the current period to variables and use these instead in the query?
Thanks in advance
Pervasive 9.5.
David Ison
I have written a simple query to generate appraisal details for Department members it is as follows.
select distinct
DP.DepartmentReference Reference,
DP.DepartmentName Name,
(select count(DM.PersonKey)DepartmentMembers from DepartmentMembershi DM
where DM.DepartmentKey = DP.DepartmentKey),
(select
count(DM.PersonKey) Appraised
from DepartmentMembershi DM,Appraisal AP
where
DM.DepartmentKey = DP.DepartmentKey and
DM.PersonKey = AP.PersonKeyAppraisee and
AP.AppraisalDate > (select
BP.StartDate
from
BudgetingPeriod BP
where BP.StartDate < CURDATE ( ) and BP.EndDate >= CURDATE ( )
and BP.Subcode = '') and
AP.AppraisalDate <= (select
BP.EndDate
from
BudgetingPeriod BP
where BP.StartDate < CURDATE ( ) and BP.EndDate >= CURDATE ( )
and BP.Subcode = '')
and AP.AppraisalStatus ='ACTU'
and AP.AppraisalType = 'ANNL'),
PD.DepartmentReference DeptAbove
from
Department DP
Left Outer Join Department PD
on
DP.DepartmentKeyDepar = PD.DepartmentKey
As you can see I only require Appraisal that occur in the current budged period. Can I assign the start and end dates of the current period to variables and use these instead in the query?
Thanks in advance
Pervasive 9.5.
David Ison