Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

need it in summarized form

Hi experts

i had created a query in sql

pls find the below attached one

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

SELECT dISTINCT OHEM.U_DeptName, OHEM.termReason,OHEM.termDate FROM OHEM

WHERE OHEM.termReason IN ('2','3','1') AND OHEM.termDate BETWEEN '2015-01-01 00:00:00.000' AND '2015-09-06 00:00:00.000'

when i run this query am getting the result in Single employees wise insted of that i need it in summarized Dept wise way lik this

i need this query to be used in Crystal report by adding the query as SPT in sql

u_dept name        TOTAL          YEAR

A                          10                  2015

B                            25                 2015

C                            30                 2015

Pls help to sort it out

Regards

replied

Try this:

Select U_DeptName, count(U_DeptName), year(termdate)

From OHEM

where TermReason in('1','2','3') and termdate between '2015-01-01 00:00:00.000' and '2015-09-06 00:00:00.000)

Group by U_DeptName, year(termdate)

Order by U_DeptName

Regards,

JC

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question