Home > Software > Data-Warehouse > DataStage
Interview Questions   Tutorials   Discussions   Programs   Discussion   

DataStage - I have a table col1 10 20 30 40 10 20 50 my requirement is how to retrieve only duplicates like 10 10 20 20 like this how it's possible in SQL?




562
views
asked mar September 20, 2014 06:32 AM  

I have a table col1 10 20 30 40 10 20 50 my requirement is how to retrieve only duplicates like 10 10 20 20 like this how it's possible in SQL?


           

2 Answers



 
answered By   0  

We can use below query:

SELECT COL1 FROM TABLE GROUP BY COL1 HAVING COUNT(COL1)>1

it can only display the duplicate records

     src    tg

for ex:-COLI COL1 10 10 20 20 30 40 10 20 10

flag   
   add comment

 
answered By vishnoiprem   0  

We can use below query:

   Select * from
TBL1 a
INNER JOIN
(Select col1, count(1) from TBL1 having count(1)>1
group by 1)REF
ON (a.col1=ref.col1)
flag   
   add comment

Your answer

Join with account you already have

FF

Preview

 Write A Tutorials
Online-Classroom Classes
www.writeabc.com


  1 person following this question

  1 person following this tag

  Question tags

datastage × 4

Asked 2 years and 3 months ago ago
Number of Views -562
Number of Answers -2
Last updated
3 years and 2 months ago ago

  Similar questions


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert