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 features of datastage flow designer?
How do you register plug-ins?
Why do we use link partitioner and link collector in datastage?
Is the value of staging variable stored temporarily or permanently?
What is ibm datastage flow designer?
What is a merge?
How can you write parallel routines in datastage PX?
What is a quality stage in datastage tool?
What could be a data source system?
What are some different alternative commands associated with "dsjob"?
Field,NVL,INDEX,REPLACE,TRANSLATE,COLESC
Which algorithm you used for your hashfile?
table actions available in oracle connector?
How many types of stage?
what is the use of surogate key in datastage