Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting sub category count
Message
De
07/02/2016 01:05:17
 
 
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:
01631028
Vues:
45
>To only get first level subcategories count:
>
>
>SELECT Category.Numero, Category.Anglais, ISNULL(SubC.Compte,0) as Compte
> FROM Category
>OUTER APPLY (select count(*) as Compte from Category AS Category2 
>where Category.Numero=Category2.NoCategory) SubC
> WHERE Category.NoClient=78 AND Category.NoCategory=0
>
This ones avoid the usage of repetitive MIN(). It is much better.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform