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 is "fatal error/rdbms code 3996" error?
What is ibm datastage flow designer?
State the difference between an operational datastage and a data warehouse?
What are the main differences you have observed between 7.x and 8.x version of datastage?
What are the different common services in datastage?
Could anyone give brief explanation bout datastage admin
What is the precedence of stage variables,derivations, and constraints?
what are the devoleper roles in real time? plz tell i am new to datastage....
What are the areas of application?
What is the difference between account and directory options ?
whom do you report?
Explain the importance of surrogate key in data warehousing?
Which commands are used to import and export the datastage jobs?
Define Data Stage?
Hi, what is use of Macros,functions and Routines..? At what situation you are used. If you know the answer please explain it. Thanks.