Home » SQL & PL/SQL » SQL & PL/SQL » select only duplicate values.............
select only duplicate values............. [message #186835] Wed, 09 August 2006 15:21 Go to next message
imtiazmasud
Messages: 49
Registered: May 2005
Location: Bangladesh
Member

hi,
I have a table has more that values like this (duplicate values)
example
ID value
--------- ---------
101---->2000
102---->3000
101---->5000
103---->2400
102---->4500

output like this:

ID value
--------- ---------
101---->2000
101---->5000
102---->3000
102---->4500

How can I do this ? ............imtiazmasud
Re: select only duplicate values............. [message #186839 is a reply to message #186835] Wed, 09 August 2006 15:53 Go to previous messageGo to next message
Littlefoot
Messages: 20894
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
select id
from your_table
group by id
having count(*) > 1;
Re: select only duplicate values............. [message #187321 is a reply to message #186835] Sat, 12 August 2006 00:49 Go to previous messageGo to next message
imtiazmasud
Messages: 49
Registered: May 2005
Location: Bangladesh
Member

Hi man,
Now showing the result as my format..please ..imtiazmasud
Re: select only duplicate values............. [message #187325 is a reply to message #186835] Sat, 12 August 2006 02:47 Go to previous messageGo to next message
rameshuddaraju
Messages: 69
Registered: June 2005
Location: India
Member

you can use subquery as follows

select * from yourtable
where id in(select id from yourtable group by id having count(*)>1)
Re: select only duplicate values............. [message #188005 is a reply to message #187325] Wed, 16 August 2006 12:33 Go to previous message
imtiazmasud
Messages: 49
Registered: May 2005
Location: Bangladesh
Member

hi man,
Its working..man..Though I am late to thank you because I was a bit busy with some of my other work and just opened and did as you said..Thanks for your reply....imtiazmasud
Previous Topic: Loop Help
Next Topic: DBMS_LOCK.sleep(5) giving error
Goto Forum:
  


Current Time: Mon Dec 05 08:36:37 CST 2016

Total time taken to generate the page: 0.10772 seconds