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

Answer Posted / ramesh

SQL:

1. SELECT A.COL1 FROM TABLE1 A

2. ( SELECT COL1, COUNT(COL1)FROM TABLE1
GROUP BY (COL1)
HAVING COUNT(COL1)=1)B

WHERE

3. A.COL1<>B.COL1

RESULT : 1. 10 20 30 40 10 20 50
2. 30 40 50
3. 10 10 20 20

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the functionalities of link partitioner and link collector?

594


What is job control?

622


How to reverse the string using unix?

2805


Define meta stage?

780


how to add a new records into source?

1525






What are the repository tables in datastage?

819


What are stage variables and constants?

700


What is the difference between validated and compiled in the datastage?

699


What is ibm datastage?

603


How do y read Sequential file from job control?

14402


What is "fatal error/rdbms code 3996" error?

663


Define project in datastage?

660


What are the benefits of datastage?

721


On which interface you will be working as a developer?

633


How to convert RGB Value to Hexadecimal values in datastage?

3456