Results 1 to 6 of 6

Thread: Query to find out duplicate records

  1. #1
    Join Date
    Nov 2009
    Posts
    95

    Query to find out duplicate records

    Hi All,

    I am working on very complicate SQL projects. My projects includes more than one table. In which I need to find out any duplication of rows which has same content. According to you which function I will need to use in query to find out the duplicate records in the tables. I would greatly appreciate your any help over this query.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Query to find out duplicate records

    Hi,

    I think you should use the "Having" clause in your SQL query. "Having" clause find out the duplication of the provided table field. Please refer the below example of the "Having clause":
    SELECT emailID, COUNT(emailID) AS NumOccurrc
    FROM acct GROUP BY emailID
    HAVING ( COUNT(emailID) > 1 )

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Query to find out duplicate records

    If you want to display the records which is unique among the table, Please use the "Dinstinct" clause of the SQL. This keywords avoids the duplication of the table fields. Suppose there is one field value which is repeated three times in the table, if you use "Dinstinct" clause it will display only one occurrence of that value. See below query:
    Select Distinct Name, empID from empl
    where
    salary>=10000

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Query to find out duplicate records

    Hi ,

    I also want the similar SQL query which find out the duplicate records. I have three sql databases for my projects. I don't want any value which is common for all three sql databases.
    I have tried to use the "Distinct" and "Having" Clause but it didn't give me the desired output. Please let know the proper executable SQL query for duplicated records . I waiting for reply..

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Query to find out duplicate records

    Following query is useful to find out the duplicates records from the two tables named as "tes" and "dup" . In this example I have used the where concept of the SQL query language:
    select d
    , count(*)
    , min(i) from tes
    where
    1 < (select count(*)
    from tes, dup
    where tes.d = dup.d
    ) group by d

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Query to find out duplicate records

    Hello,

    You can try below some SQL queries to find out the duplicate records of the table:

    1. select * from lmn group by FieldName HAVING count(distinct FieldName > 0)
    2. select distinct(FieldName ) from TableName.
    3. select distinct(Sname ) from TableNamestud.

Similar Threads

  1. How to find & delete duplicate files in Apple Mac OSX
    By Acardi !! in forum Windows Software
    Replies: 10
    Last Post: 30-04-2013, 03:02 PM
  2. SQL Query For Copy records from one table to another
    By Bellamy in forum Software Development
    Replies: 4
    Last Post: 23-05-2010, 12:36 AM
  3. How to find duplicate files on Windows 7
    By Baker in forum Windows Software
    Replies: 5
    Last Post: 11-12-2009, 07:07 PM
  4. SQL find and replace query
    By Seraphim in forum Software Development
    Replies: 3
    Last Post: 26-05-2009, 01:40 PM
  5. Duplicate PTR records in reverse lookup zone
    By TSAM in forum Windows Server Help
    Replies: 4
    Last Post: 13-11-2008, 07:24 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,428,411.34095 seconds with 17 queries