Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I get count of leaves with respect to employee code in SQL?

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:

Code Output

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading