Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting sub category count
Message
From
07/02/2016 01:05:17
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2014
OS:
Windows 8.1
Network:
Windows 2008 Server
Miscellaneous
Thread ID:
01631008
Message ID:
01631028
Views:
44
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform