## How to get the total number of records without duplicating

Asked By 20 points N/A Posted on -

I want to get the total number of records retained without DUPLICATE ones in my database. IS this correct?

SHARE
Answered By 0 points N/A #90545

## How to get the total number of records without duplicating

Hello Jennina,

That is possible, but you will have to do some extra work JFirst you’ll have to count all records in a  column using this formula:

SELECT COUNT (jennina’s column) FROM (jennina’s_table name)

After that you have to count duplicate rows with this formula

SELECT (jennina’s column), COUNT(*) TotalCount
FROM jennina’s_table name
GROUP BY jennina’s column
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC

after that you'll just have to subtract total count and duplicate count, and voila, your total is counted without duplicate rows.

Hope this helps, if you have any question regarding this don’t be afraid to ask!

Answered By 572920 points N/A #90546

## How to get the total number of records without duplicating

Almost all of the posts I saw on the web discuss the method of counting the number of records in the database using the duplicate ones. And since you only want unique results in your query this is not appropriate for you. I found an example which is very similar to your inquiry and was able to solve it using 2 methods of counting the records or counting the sum of the rows without the duplicates.

The sample above has “CustomerID” with 6 records in it. It contains 2 duplicates which supposedly will return 4 unique records only ignoring the duplicates when doing the query. To do this, any of these 2 methods can be used:

Answered By 20 points N/A #90547

## How to get the total number of records without duplicating

Well, itâ€™s really hard to keep the records retained without duplicating ones in a database. Now I have got the easiest technique to keep the record with an easy command. Thanks Sharath, for helping me with these command lines. It has made my work faster and smoother. You provided a simple way on how to manage and keep the records without any duplication that happens. Now I can generate a record file easily. So easy that I couldnâ€™t ever imagine how I have done it! I spent about a week in thinking about this performance and now I donâ€™t have to!