i think what you need is something like thisSELECT Inv_Cust,SalescountFROM(Select Inv_Cust,Count(Inv_Cust) as Salescount ,DENSE_RANK() OVER (ORDER BY Count(Inv_Cust) DESC) AS RnkFrom Inv_Header where Inv_Date >= DATEADD(mm,DATEDIFF(mm,0,GETDATE())-6,0)AND Inv_Date < DATEADD(mm,DATEDIFF(mm,0,GETDATE())+1,0)Group By Inv_Cust)tWHERE rnk=1
[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs