Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group by and Count
Message
From
13/09/2021 18:11:20
 
 
To
13/09/2021 17:47:33
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01682285
Message ID:
01682286
Views:
51
Apparently, adding a count with distinct seems to work :
SELECT MAX(Program.Name) AS Program,MAX(Something.Name) AS Something,COUNT(*) AS 'Count of projects',COUNT(DISTINCT Provider.ID) AS Providers
 FROM MainTable
 INNER JOIN Program ON MainTable.NoProgram=Program.ID
 INNER JOIN Something ON MainTable.NoSomething=Something.ID
 INNER JOIN Project ON MainTable.ID=Projet.NoMainTable
 INNER JOIN Provider ON Projet.NoProvider=Provider.ID
 GROUP BY Program.Name,Something.Name
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform