Input Data is:
Emp_Id, EmpInd
100, 0
100, 0
100, 0
101, 1
101, 1
102, 0
102, 0
102, 1
103, 1
103, 1
I want Output
100, 0
100, 0
100, 0
101, 1
101, 1
Means Indicator should either all ZEROs or all ONEs per
EmpId.
Impliment this using SQL and DataStage both.
Answer Posted / lb14447
The sql query would be
SELECT * FROM EMPTEST WHERE EMP_ID IN (SELECT EMP_ID FROM EMPTEST GROUP BY EMP_ID HAVING SUM(EMP_IND)/COUNT(EMP_IND) = 0
OR SUM(EMP_IND)/COUNT(EMP_IND) = 1);
Datastage implementation:
SRC --> CPY ----> AGG---> FILTER
- |
- |
- |
- |
- |
--------> Look up ----> TGT
In the Aggregator stage calculate the Sum and Count fields.In the filter stage bypass the unwanted records using Sum and Count calculated in Aggr stage.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How rejected rows are managed in datastage?
Could anyone give brief explanation bout datastage admin
What are the different common services in datastage?
Differentiate between Join, Merge and Lookup stage?
how many rows sorted in sort stage by default in server jobs
What are the functionalities of link collector?
What is the differentiate between data file and descriptor file?
sed,awk,head
how to write server Routine coding?
Is it possible to implement parallelism in Mainframe Jobs ? If Yes how ? If no why ?
Can we use target hash file as a lookup ?
What is Ad-Hoc access? What is the difference between Managed Query and Ad-Hoc access?
Difference between ‘validated ok’ and ‘compiled’ in data stage?
What is ibm datastage flow designer?
What is a folder? Difference types of stages?