-2
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

5
  • 2
    As per the question guide, please do not post images of code, data, error messages, etc. - copy or type the text into the question. Please reserve the use of images for diagrams or demonstrating rendering bugs, things that are impossible to describe accurately via text. Commented Mar 4, 2022 at 9:03
  • 2
    You need to ensure your question contains both sample data and desired results. Commented Mar 4, 2022 at 9:04
  • 2
    Use COUNT? Your question is completely unclear. Show us some consumable sample data (not an image), the expected results, your attempt(s) and explain why they aren't working. Also include the logic you want to get from your sample data to your expected results. Commented Mar 4, 2022 at 9:05
  • okay I am sorry @Dake K . Actually I am new in this platform. Commented Mar 4, 2022 at 9:13
  • Considering the accepted answer, perhaps a search would have given you all the resources you needed. Learning to use a search engine is a vital life skill in this age. Commented Mar 4, 2022 at 9:18

2 Answers 2

0

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
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.