I am working on a one to many query for an assets database. Here is some sample data
Server Name Application Primary_User
Server1 SQL DBA
Server1 Citrix IT
Server1 Oracle DBA
Server2 Sharepoint Web
Server3 SQL DBA
Server3 Sharepoint Web
Server3 Norton Security
Server3 IDS Security
The desired output is one row per server with the server name, count of applications, and the Primary User that appears the most (not just the first, last, min, or max).
It would look like this
Server Name Applications Primary_User
Server1 3 DBA
Server2 1 Web
Server3 4 Security
Is there a query or sub query that can accomplish this?
Just a note that this query will have to be executed in Excel.
Thanks in advance!