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
What is datastage engine?
What is ibm datastage?
Difference between data warehousing and olap?
what should be ensure to run the sequence job so that if its get aborted in 10th job before 9job should get succeeded?
Where the datastage stored his repository?
Is possible to create skid in dim,fact tables?
How one source columns or rows to be loaded in to two different tables?
Source has 2 columns: USA,NewYork INDIA,MUMBAI INDIA,DELHI UDS,CHICAGO INDIA,PUNE i want data in target like below: INDIA,MUMBAI1 INDIA,DELHI2 INDIA,PUNE3 USA,NEWYORK1 USA,CHICAGO2
How can we improve the performance in datastage?
Hi , Can anyone give few examples of scenarios and there corresponding design in datastage..i am new to this tool...confused in design while my manager asking to design the job.. Please post the URL if there..so i can go through it.. Thanks in advance...
how to use self join using datastage ? can u tell me using stage how can we implemnet the self join
What is difference between server jobs & parallel jobs?
hi.... am facing typical problem in every interview " I need some critical scenarios faced in real time" plz help me guys
tell me 5 situations when we r using oracle db stages like orecle connector, oracle enterprise
What is the difference between passive stage and active stage?