i/p o/p1 o/p2
1 1 4
1 1 5
1 1 6
2 2
2 2
2 2
3
3
4
5
6
how to populates i/p rows into o/p1&o/p2 using datastage
stages?and also the same scenario using sql?
Answers were Sorted based on User's Feedback
Answer / radhakant kumar
1)by sql say the column name is Id then
a)(for duplicate)
select a.id
from table_name a
left outer join(select id,count(*)as no1
from table_name
group by id
)b
on b.id=a.id
where b.no1>1
order by a.id
it will display 1 1 1 2 2 3 3
b)change the condition where b.no1=1 then it will display
the remainings without duplicates..
2) By DataStage
Step By Step....
a)after source file take Copy stage and draw two
output links
b)one will go to Aggregate stage and take count of
rows by group by Field(id)
it will display like.
ID Count(no)
1 3
2 3
3 2
4 1
5 1
6 1
c)and then use lookup stage main stream will be second link
of copy and reference will be output of Aggregate stage
d)look up key will be ID and fetch count(no) to target
it will display
ID Count(no)
1 3
1 3
1 3
2 3
2 3
2 3
3 2
3 2
4 1
5 1
e)and after lookup stage take transformer or filter stage
by taking two output links and put condition
a)for duplicates count(no)>1
b)for non duplicates count(no)=1
Finally u will get your desired output..
6
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / kalpana_241871
SQL>
SELECT COL1 FROM TAB1 GROUP BY COL1 HAVING COUNT(*) > 1 ;
O/P 1 :
1
1
1
2
2
2
3
3
SQL>
SELECT COL1 FROM TAB1 GROUP BY COL1 HAVING COUNT(*) = 1 ;
O/P 2 :
4
5
6
| Is This Answer Correct ? | 11 Yes | 2 No |
Answer / kavitha
sequentialfile-----copy-----head and tail(in that we have options like no of rows=6 for head and n..o..r=4 for tail)then connect two data sets to that head and tail u will get
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / rvanaja.etldeveloper@gmail.com
just read the data in sequential file
and take aggregator
group=cid
aggregation type=count rows
count output column=countno
then take filter from filter you drag 2 links for two outputs
in filter write conditions like bellow and give link order
where clause=countno>1
and
where clause=countno=1
map in output links
seqfile-->aggregator-->filter-->2 torgets
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / vijaya
Hi
first sort the input date then use the transformer stage by
using stage variables you can use the logic like check the
first record then check the second record if both are equal
send the output to o/p1 or else send to o/p2....
I hope i made u understand the logic
| Is This Answer Correct ? | 2 Yes | 11 No |
Answer / srinivas
first sort the data,
then
take two stage variable
if (sv1=sv2) then ds.link1 else ds.link2
| Is This Answer Correct ? | 1 Yes | 13 No |
CAN WE DECLARE DATASET SET WITH OTHER THAN .DS EXTENTION OR NOT IF YES WHAT IS THE DIFFERENCE U FIND?IF NOT WHY?
This is UNIX question asked in DataStage Interview. Say I have n numbers of records in a text file. I want first 3 records in 1st file, last three records in 3rd file and remaining n-6 records in 2nd file. (Note: we don't know how many records are there in the File. I am getting one file on daily basis and I want three target files as asked above)
one file contains col1 100 200 300 400 500 100 300 600 300 from this i want to retrive the only duplicate like this tr1 100 100 300 300 300 how it's possible in datastage?can any one plz explain clearley..........?
how can u handle null values in transformer stage.
plz tell me some dimentional and fact table names in banking project?
Define data aggregation?
what is ds administrator used for?
How can we select pr retrieve the particular row in dataset by using orchadmin command?
What is the Environment Variable need to Set to TRIM in Project Level?(In transfermer, we TRIM function but I need to impliment this project level using Environment variable)
client know skid info?
How to remove ctrl M or(^M) characters in file using Sequential File stage?
2 Answers Bank Of America, Satyam,
what is set mapping in datastage??