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
hi.... am facing typical problem in every interview " I need some critical scenarios faced in real time" plz help me guys
Notification Activity
How to reverse the string using unix?
What is the difference between datastage and datastage tx?
How to reverse the string using SQL?
How do you generate sequence number in datastage?
What is the difference between odbc and drs stage?
how many rows sorted in sort stage by default in server jobs
Name the different sorting methods in datastage.
what is the use of surogate key in datastage
how to achieve this output ? Two Input columns(ID & Name) - ID | Name 1 | Jack 1 | Kara In output there should be only 1 column which will be populated as - 1,Jack 1,Kara
Field,NVL,INDEX,REPLACE,TRANSLATE,COLESC
If you want to use the same piece of code in different jobs, how will you achieve it?
Can you explain engine tier in information server?
How to perform incremental load in datastage?