If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Select duplicate column values

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-13-03, 10:21
r123456 r123456 is offline
Registered User
 
Join Date: Sep 2003
Location: The extremely Royal borough of Kensington, London
Posts: 778
Select duplicate column values

Hi,

How do I select rows that contain the duplicate values for a giev column.

Eg,

C1 | C2
a
b
a

I need to select a.

Cheers.
Reply With Quote
  #2 (permalink)  
Old 10-13-03, 10:52
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
select C1, C2
from yourtable
where C1 in
( select C1 from yourtable
group by C1
having count(*) > 1 )
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 11-28-11, 14:24
Sathya65 Sathya65 is offline
Registered User
 
Join Date: Nov 2011
Posts: 2
Select Single Duplicate Value + Select the other values

Hi,

I want to select only one duplicate value from the column + select other values.

For ex:

Column 1 Column 2 Column 3

28/11/2011 Item 1 Received

27/11/2011 Item 2 Received

24/11/2011 Item 3 Pending

28/11/2011 Item 4 Pending

25/11/2011 Item 5 Pending



I want to get output like this :


24/11/2011

25/11/2011

27/11/2011

28/11/2011 ----> This is single value from the duplicate values and also

sorted.


If any one know how to get this output, please reply.
Reply With Quote
  #4 (permalink)  
Old 11-28-11, 14:34
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
wow, an 8-year-old thread, answered within 10 minutes

Quote:
Originally Posted by Sathya65 View Post
If any one know how to get this output, please reply.
Code:
SELECT DISTINCT column1
  FROM daTable
ORDER
    BY column1
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 11-28-11, 17:02
Sathya65 Sathya65 is offline
Registered User
 
Join Date: Nov 2011
Posts: 2
Thanks

Thanks a lot. It work's. What is your name?
Reply With Quote
  #6 (permalink)  
Old 11-28-11, 19:25
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
i am the rudeboy, the rudester, the sqlmeister

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On