Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 doubt

Author  Topic 

shanmugajothi
Starting Member

1 Post

Posted - 2011-11-26 : 09:45:46
i had listed out department id and the number of duplicates present in it but i donno how to find the highest duplicate in the list

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-26 : 10:06:16
define highest duplicate. How do you determine highest? do you've any unique valued column to determine it?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-11-26 : 10:06:27
You could use the MAX function as in "select max(duplicate_count) from yourTable".

Sometimes ORDER BY clause is more efficient - for example, "select top 1 duplicate_count from yourTable ORDER BY duplicate_count DESC"
Go to Top of Page
   

- Advertisement -