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
Difference between sequential file and data set?
Can you explain repository tables in datastage?
How to reverse the string using SQL?
What are the main features of datastage?
How can we improve the performance in datastage?
How do y read Sequential file from job control?
What are the types of containers and how to create them?
What are the functionalities of link partitioner?
Differentiate between validated and Compiled in the Datastage?
how to abort the job its matain duplicates?
What are the components of datastage?
What could be a data source system?
What all the types of jobs you developed?
how do u catch bad rows from OCI stage? And what CLI stands for?
Can we use target hash file as a lookup ?