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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Max(count(*))

Author  Topic 

shashwat2691
Starting Member

11 Posts

Posted - 2011-03-11 : 17:29:30
Suppost my table is as follows

Incoming {ACN, Date, Amount}

Now, I want to know the account number of a record who has maximum ACN count in this table.

Shashwat Tripathi - INDIA

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-03-11 : 17:34:09
SELECT TOP 1 ACN FROM Incoming GROUP BY ACN ORDER BY COUNT(*) DESC
Go to Top of Page

shashwat2691
Starting Member

11 Posts

Posted - 2011-03-11 : 17:39:12
Thanks a lot robvolk, You are brilliant......

Shashwat Tripathi - INDIA
Go to Top of Page
   

- Advertisement -