Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting sub category count
Message
 
 
À
06/02/2016 11:15:50
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2014
OS:
Windows 8.1
Network:
Windows 2008 Server
Divers
Thread ID:
01631008
Message ID:
01631009
Vues:
46
>I have a list of categories. Some of them have sub categories. When I select the categories, I need to include a count field which would indicate either 0, if there is no sub category for that category, or a count indicating how many sub categories that category has. I am looking for the most effective simple SQL syntax for that.

Something like
SELECT COUNT(DISTINCT SubCategoryID) FROM Whatever WHERE CategoryID = 123 ....
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform