2019 Nov 27 10:32 AM
HI Gurus,
Pls share code for this
Write a select query list all Manager Id & Manager names who have at least One ‘MALE’ employee and one ‘FEMALE’ employee reporting to them.\
NOTE its has to be acheived through query no by using read,collect, delete .. etc.
There are 2 tables
ZGGL_MANAGER (Manager table)
PRIMARYKEY MANAGER_ID MANAGER_NAME
Table: ZGGL_EMPLOYEE
MANAGER_ID EMPLOYEE_ID GENDER_ID EMPLOYEE_NAME
HI Gurus,
Pls share code for this
Write a select query list all Manager Id & Manager names who have at least One ‘MALE’ employee and one ‘FEMALE’ employee reporting to them.\
NOTE its has to be acheived through query no by using read,collect, delete .. etc.
There are 2 tables
ZGGL_MANAGER (Manager table)
PRIMARYKEY MANAGER_ID MANAGER_NAME
Table: ZGGL_EMPLOYEE
MANAGER_ID EMPLOYEE_ID GENDER_ID EMPLOYEE_NAME
2021 Oct 10 7:08 PM
2021 Oct 19 4:25 PM
Hi rahul.singh311,
try this:
select m~manager_id
, m~manager_name
from ZGGL_MANAGER as m
where exists ( select 1 " or @abap_true ?
from ZGGL_EMPLOYEE as e1
where e1~manager_id = m~manager_id
and e1~gender = 'M' )
and exists ( select 1 " or @abap_true ?
from ZGGL_EMPLOYEE as e2
where e2~manager_id = m~manager_id
and e2~gender = 'F' )
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |