top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to find the repeated rows in a SQL table?

0 votes
503 views
How to find the repeated rows in a SQL table?
posted Mar 12, 2016 by Aditi

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
 
Best answer

if you are getting repeated rows then I think there is not any primary key defined in the table so count values based on all column name.Run this script,it will return all rows which occurs more than once in the table.

  SELECT   *
    FROM
        YourTableName
    GROUP BY
        Name,PhoneNumber,Address    //if your table has three columns but it will be easy with id
    HAVING 
        COUNT(*) > 1
answer Mar 13, 2016 by Shivam Kumar Pandey
0 votes

Hi, u may try like this:

select * from table_name 
 GroupBy Name.MobileNum.Address 
Having
 count(*)>1
answer Sep 11, 2019 by Siddhi Patel
Similar Questions
+1 vote

which of the following is better to find the number of rows in a table?
1. count(1)
2. count(*)
3. count(rowid)

+1 vote

I am building a small web application of online library and I want to find out the difference between issue date and Submission date of the books.
My sql table has 5 values
1) name
2) ID number
3) Issue date
4) Book
5) Submission Date.
please help me with the Sql Statement that i should use to solve this problem.

...