How to create a mapping ?
id date
101 2/4/2008
101 4/4/2008
102 6/4/2008
102 4/4/2008
103 4/4/2008
104 8/4/2008
O/P - shud have only one id with the min(date)
How to create a mapping for this
Answers were Sorted based on User's Feedback
Hi Achoudhr,
here u go,
sq--->agg----->target
In agg dont use group by on any port and take output
columns for both id & date ports, use 'min' function in
outpput expression and connect output ports to desired
target columns.you will get only one output row that is 101
2/4/2008.
note: if u use group by mapping outputs 3 rows.
| Is This Answer Correct ? | 15 Yes | 6 No |
Answer / mitesh gaur
I think there is no need of using any aggregation. It's very
straight fwd, just sort the data on date and fetch only
first record.
Add the below query to source qualifier's SQL OVERRIDE
and that will be your result - (lets say table name is TmpTab)
select * from (select * from TmpTab order by date) where
rownum = 1;
now connect id, date to target.
| Is This Answer Correct ? | 9 Yes | 5 No |
Answer / rob
Add the below query to source qualifier's SQL OVERRIDE
and you will get the required output
select * from (select min(to_date(date,'dd/mm/yyyy'))as
d,id from emp
group by id order by d)where rownum =1;
source-->SQualifier(with query)----> target
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / parthiban
S->SQ->SRT->EXP->FIL->TGT
Sort on date Column
In Expression, Create variable ports for partition
V_Currdate = date
V_Flag = IIF(V_Currdate = V_Prevdate, V_Flag+1,1)
V_Prevdate =date
O_Flag = V_Flag
In Filter, Filter where O_Flag =1
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / azhar
Simple use sql override query:
select top1 * from TABLENAME order by ID,DATE
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / deepak
SQ --> Sorter (sort on date desc) --> Aggregator (select no ports so it will always return last row) --> Target
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / bidhar
I think you can get this by SQ Override query itself.
SQ->Exp->Target
SQ Override Query:
SELECT ID,MIN(DATE) FROM TABLENAME GROUP BY ID.
Let me know if i am wrong.
| Is This Answer Correct ? | 2 Yes | 4 No |
Answer / kalyan
I guess the below logic will solve this question..
Sq -> Expression T/R -> Aggr t/r -> Target
Create a constant port in Expression t/r and then pass the 3
fields id, date & const port to the aggregate t/r... Create
a new port calculating mindate.. Now do a group by on the
Const field ; connect id & min Date fields to the Target...
FYI, If u don't apply group by on any column of the table ;
can not calculate the Aggr values...
Please correct me if I am wrong...
| Is This Answer Correct ? | 1 Yes | 7 No |
difference between top down(w.h inmon)and bottom up(ralph kimball)approach?
What are the types of data that passes between informatica server and stored procedure?
star and snowflake schema?
how DTM buffer size and buffer block size are related
how can send duplicate records to one tableand non duplicate records to one table with simple clear mapping?
How does the session recovery work.
If u select groupby port in aggregator what is output and dont select groupby option what is output
how can u avoid duplicate rows in flat file?
what type of transformation is not supported by mapplets?
What is dimensional table? Explain the different dimensions.
How can the following be achieved in 1 single Informatica Mapping. * If the Header table record has error value(NULL) then those records and the corresponding child records in the SUBHEAD and DETAIL tables should also not be loaded into the target(TARGET1,TARGET 2 or TARGET3). * If the HEADER table record is valid, but the SUBHEAD or DETAIL table record has an error value (NULL) then the no data should be loaded into the target TARGET1,TARGET 2 or TARGET3. * If the HEADER table record is valid and the SUBHEAD or DETAIL table record also has valid records only then the data should be loaded into the target TARGET1,TARGET 2 and TARGET3. =================================================== HEADER COL1 COL2 COL3 COL5 COL6 1 ABC NULL NULL CITY1 2 XYZ 456 TUBE CITY2 3 GTD 564 PIN CITY3 SUBHEAD COL1 COL2 COL3 COL5 COL6 1 1001 VAL3 748 543 1 1002 VAL4 33 22 1 1003 VAL6 23 11 2 2001 AAP1 334 443 2 2002 AAP2 44 22 3 3001 RAD2 NULL 33 3 3002 RAD3 NULL 234 3 3003 RAD4 83 31 DETAIL COL1 COL2 COL3 COL5 COL6 1 D001 TXX2 748 543 1 D002 TXX3 33 22 1 D003 TXX4 23 11 2 D001 PXX2 56 224 2 D002 PXX3 666 332 ======================================================== TARGET1 2 XYZ 456 TUBE CITY2 TARGET2 2 2001 AAP1 334 443 2 2002 AAP2 44 22 TARGET3 2 D001 PXX2 56 224 2 D002 PXX3 666 332
Aggregator transformation is having fields say a,b,c,d,e group by is enabled on a,b,c with sorted input,How the aggregator transformation process the i/p data?or in which way i/p comes to agg transformation