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 > duplicate rows??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-20-06, 05:29
jagans jagans is offline
Registered User
 
Join Date: Jul 2004
Posts: 48
duplicate rows??

hi all..
how will i fetch duplicate rows in a table i want the count also
eg in my table if the same company name exist morethan once i want to fetch it

thnks in advance
Jag
Reply With Quote
  #2 (permalink)  
Old 02-20-06, 08:22
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
duplicate rows is not the same thing as multiple rows with the same value in a particular column

presumably if your table has a primary key, you will never have a duplicate row

for your question about company names, try this --
Code:
select companyname
     , count(*) as rows
  from daTable
group by companyname
having count(*) > 1
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 02-21-06, 00:37
jagans jagans is offline
Registered User
 
Join Date: Jul 2004
Posts: 48
thnks

u r right
its not duplicate its multiple nd thnks for ur query
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