write s sql query following table some duplicate present i
want unique one column duplicate another column display?

name id
a 1
a 1
b 2
b 2
c 3
i want the required output like
unique duplicate
name id name id
a 1 a 1
b 2 b 2
c 3

Answers were Sorted based on User's Feedback



write s sql query following table some duplicate present i want unique one column duplicate anoth..

Answer / ram pothineni

1) In SQ.. override the default query as below..

SELECT NAME,ID,ROW_NUM()OVER(PARTITION BY NAME ORDER BY
NAME)RN FROM TABLE_NAME

2) In router create two groups

UniqueGroup - RN = 1
DuplicateGroup - RN > 1

3) Connect Respective group to respective targets...



-- Ram Pothineni

Is This Answer Correct ?    5 Yes 2 No

write s sql query following table some duplicate present i want unique one column duplicate anoth..

Answer / anto

unique

select distinct name,id from table

duplicate

select name,id from table
group by name,id
having count(name||id) > 1

Is This Answer Correct ?    2 Yes 0 No

write s sql query following table some duplicate present i want unique one column duplicate anoth..

Answer / chandan023

1.Sort the data 
2.Expression transformation
   a)create a variable1(integer) and var2(string)
   b) var2 = concatenate all fields
   b)  set the value of the variable to 1 if (concat all fields are = var2)
   c) create a o/p port = var2
-- output of the expression t/f will be like
   NAME ID NEW_COL
   a  1 0
   a  1 1
   b  1 0
   b  1 1
   c  1 0
 3. Use a router transformation and route the data based on the new thirt column.

Happy ETLing :)

Is This Answer Correct ?    0 Yes 0 No

write s sql query following table some duplicate present i want unique one column duplicate anoth..

Answer / senthil

select a.nameid as unique_name_id,b.nameid as DUplicate_name_id
from
(select distinct nameid from name) a
left outer join
(select nameid from name group by nameid having count(*) > 1) b
on a.nameid = b.nameid

Output:
---------
unique_name_id Duplicate_name_id
a 1 a 1
b 2 b 2
c 3

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Informatica Interview Questions

source name sal aaaa 2000 bbbb 3000 abcd 5000 Target name sal aaaa 2000 bbbb 3000 abcd 5000 total 10000 how to get total as new row and sum as 10000 thanks

4 Answers   Polaris,


What is domain and gateway node?

0 Answers  


What is different between informatica version 8 and 9 version

1 Answers   Cognizant, IBM,


Is it possible to use a client with different version than that of its Informatica server?

0 Answers  


What is the filename which you need to configure in UNIX while installing infromatica?

2 Answers   Accenture,






What is informatica? Why do we need it?

0 Answers  


Why filter transformation is an active one?

0 Answers  


What are the new features of informatica 9.x in developer level?

0 Answers  


r u done any partitions in ur project?

0 Answers   TCS,


What is the use of an aggregator cache file?

0 Answers  


One source and 3 targets 1st row-1st target 2nd row-2nd target 3rd row-3rd target 4th row-1ist target how will u do?

5 Answers   HCL,


how we can load rejected record's at run time?(not through bad files)

0 Answers   TCS,


Categories