Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting sub category count
Message
 
 
À
07/02/2016 00:38:09
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:
01631025
Vues:
47
>>Can you post the structure of the table(s) involved here to determine when category has subcategories?
>
>Category table
>
>Numero Primary key
>Title Character(20)
>NoCategory Category primary key
>
>So, basically, this is recursive inside the same table.
>
>So, an unlimited number of categories can have parents and so on.
>
>For most of them, Category.NoCategory is 0 so that denotes a parent. That is the highest hierarchy.
>
>Then, for those records having a value in Category.NoCategory, it means they are child records of the parent. The parent can also be a child of another parent.

So, do you want to count all subcategories or just top level subcategories? In the former case we're talking about recursive CTE.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform