Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Retrieve the data which are only duplicates

This is a discussion on Retrieve the data which are only duplicates within the SQL forums, part of the Databases category; How to retrieve the data which are only duplicates .... (ie, if have in "prasad" in the "ename" COLUMN four times, I have to retrieve only the prasad for 4 ...

Go Back   Geeks Talk > Databases > SQL
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 06-15-2007
Expert Member
 
Join Date: Feb 2007
Posts: 1,279
Thanks: 0
Thanked 192 Times in 154 Posts
Geek_Guest has a spectacular aura aboutGeek_Guest has a spectacular aura aboutGeek_Guest has a spectacular aura about
Retrieve the data which are only duplicates

How to retrieve the data which are only duplicates .... (ie, if have in "prasad" in the "ename" COLUMN four times, I have to retrieve only the prasad for 4 times as my output)

Question asked by visitor prasad
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-16-2007
Junior Member
 
Join Date: Nov 2006
Location: Hyderabad
Posts: 9
Thanks: 0
Thanked 4 Times in 3 Posts
vijay.akki is on a distinguished road
Re: Retrieve the data which are only duplicates

select ename from Emp
group by ename where rownum<=4;
Reply With Quote
  #3 (permalink)  
Old 06-26-2007
Contributing Member
 
Join Date: Apr 2007
Location: bangalore
Posts: 46
Thanks: 0
Thanked 9 Times in 9 Posts
reetasharma108 is on a distinguished road
Re: Retrieve the data which are only duplicates

select * from table_nm where column_nm in(select col_name from table_name group by col_nm having count(1)>1);
for example:-

select * from emp where job_id in (select job_id from emp group by job_id having count(1) > 1);
Reply With Quote
  #4 (permalink)  
Old 06-26-2007
Junior Member
 
Join Date: Jun 2007
Location: Bangalore
Posts: 7
Thanks: 1
Thanked 2 Times in 2 Posts
Rksinghpathania is on a distinguished road
Arrow Re: Retrieve the data which are only duplicates

select ename from emp
having count(ename)>1
group by ename

Last edited by Rksinghpathania; 06-26-2007 at 09:17 AM.
Reply With Quote
Reply

  Geeks Talk > Databases > SQL

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Retrieve data from emp table Sampurna SQL 4 08-13-2008 08:07 AM
Retrieve the detail from emp Geek_Guest Oracle 4 07-12-2007 07:20 AM
Phelix: music duplicates removal tool with acoustical matcher. JobHelper Geeks Lounge 0 04-04-2007 04:30 AM
Help me retrieve my password joel MY SQL 1 12-19-2006 02:53 AM
Retrieve a pdf document from database Lokesh M Database General 5 12-18-2006 08:44 AM


All times are GMT -4. The time now is 07:00 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved