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


Please Help Members By Posting Answers For Below Questions

Can anyone tell me a difficult situation who have handled while creating Datastage jobs?

2849


Difference between ‘validated ok’ and ‘compiled’ in data stage?

682


What are the types of containers and how to create them?

562


Can you filter data in hashed file?

3355


Does datastage support slowly changing dimensions ?

663






What can we do with datastage director?

679


How to find value from a column in a dataset?

1773


Demonstrate experience in maintaining quality process standards?

1948


if we using two sources having same meta data and how to check the data in two sources is same or not? and if the data is not same i want to abort the job ?how we can do this?

1761


In Datastage, how you can fix the truncated data error?

648


What is merge stage?

771


hi.... am facing typical problem in every interview " I need some critical scenarios faced in real time" plz help me guys

2429


What are the components of datastage?

662


Can you explain players in datastage?

713


tell me 5 situations when we r using oracle db stages like orecle connector, oracle enterprise

2712