• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Finding duplicates

 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to find the duplicate records from the table. My table structure is : 1st column is auto generated number, second column is listname and third column is data. I want to find out the duplicates from table with same listname and data.

I am confused with this. Can anybody help me?

Regards,
Anand
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this query , It will fetch only those records from table where listname and data is being repeated. but this may not solve your problem completely because it will exclude those value which are not being repeated as part of group (LISTNAME, DATA)



SELECT LISTNAME, DATA, COUNT(*) FROM MY_TABLE GROOUP BY LISTNAME, DATA HAVING COUNT(*) > 1


Thanks,
Shailesh
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shailesh Chandra:
SELECT LISTNAME, DATA, COUNT(*) FROM MY_TABLE GROOUP BY LISTNAME, DATA HAVING COUNT(*) > 1



just post to make a little correction in query,
remove the extra the "O" in GROUP BY clause.
 
reply
    Bookmark Topic Watch Topic
  • New Topic