select PER_CODE as [EMP CODE], EXC_DATE as LEAVES
from R5EXCEPTIONS
inner join R5PERSONNEL on PER_CODE = EXC_PERSON
Mention above is my above code. I want to get count of leaves in another column.
Mention below is my code output:
CodePudding user response:
You can count the number of leaves by grouping employee code
Select PER_CODE As [EMP CODE] , COUNT(EXC_DATE) as LEAVES from
R5EXCEPTIONS inner join R5PERSONNEL on PER_CODE = EXC_PERSON
group by PER_CODE
CodePudding user response:
You can use an aggregate SQL query to get the number of PER_CODE events by date.
The following would represent this:
select count(PER_CODE) as [EMP VOL], EXC_DATE as LEAVES
from R5EXCEPTIONS
inner join R5PERSONNEL on PER_CODE = EXC_PERSON
Group by EXC_DATE