Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by and Count
Message
De
13/09/2021 18:11:20
 
 
À
13/09/2021 17:47:33
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01682285
Message ID:
01682286
Vues:
52
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform