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 / subhash
1. SQL:
SELECT * FROM
( SELECT EmpId, COUNT(*) AS CNT1 FROM EMP GROUP BY
EmpId) E1,
( SELECT EmpId, COUNT(*) AS CNT2 FROM EMP GROUP BY
EmpId, EmpInd) E2,
WHERE E1.EmpID = E2.EmpId AND
E1.CNT1 = E2.CNT2;
2.DataStage:
SRC--->CPY---->JOIN----TFM---TGT
| /
| /
| /
| /
AGG
In AGG, GROUP BY EmpId, calculate CNT and SUM.
JOIN both one copy from CPY and 2nd Aggrigated copy from
AGG.
In TFM, put constraint: IF CNT=SUM, then populate to TGT
then u will get required output.
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What are the functionalities of link collector?
How you can fix the truncated data error in datastage?
What is datastage engine?
What is the difference between datastage and datastage tx?
What is a merge in datastage?
what are .ctl(control files) files ? how the dataset stage have better performance by this files?
Where the datastage stored his repository?
What is the project in datastage?
What are transforms and what is the differenece between routines and transforms?
How to find value from a column in a dataset?
What are the important features of datastage?
What are the stages in datastage?
What is the difference between orabulk and bcp stages?
What is difference between join, merge and lookup stage?
What are the different kinds of views available in a datastage director?