Question

SQL query for absence and current balance

  • 11 April 2024
  • 0 replies
  • 12 views

Userlevel 4
Badge +9

Hello, 

 

I want to build a Quick Report in which the available absence hours and current balance hours from current balance summary are displayed per employee. 

I have made the following SQL statement in which the current balance hours are displayed correctly, but the absence hours are incorrect. I can not seem to get the query right, is there someone who can? 

 

SELECT ve.emp_no AS Personeelsnummer, 
ifsapp.COMPANY_PERSON_API.Get_Internal_Display_Name(ve.company_id,ve.EMP_NO) AS Naam, 
SUM(ve.abs_hours_limit_unused) AS Verlofsaldo,
AVG(tv.balance_avail) AS Saldo
FROM ABSENCE_LIMIT_OVERVIEW ve, TIME_BALANCE_VALUE_SUM tv
WHERE ve.emp_no=tv.emp_no
AND ifsapp.COMPANY_PERSON_API.Get_EMPLOYEE_STATUS(ve.company_id,ve.EMP_NO) = '*'
AND ve.emp_no <> '2'
GROUP By ve.emp_no,  ifsapp.COMPANY_PERSON_API.Get_Internal_Display_Name(ve.company_id,ve.EMP_NO), ifsapp.COMPANY_PERSON_API.Get_EMPLOYEE_STATUS(ve.company_id,ve.EMP_NO), ve.company_id


0 replies

Be the first to reply!

Reply