can i help about this problem

  • I have the following tables Categorie and ProductCateg ,CategorieChild

    table CategorieChild ====> IdCategorieChild | Idcategorie

    -----------------------------

    HP Vista | Con1

    HP XP | Con1

    UPS | Con1

    Linksys Postes

    Table Categorie ==> Idcategorie | Name

    --------------------

    Con1 N1

    Postes N2

    table ProductCateg ==> IdProductCateg | Idcategorie

    ----------------------------

    HP Vista Con1

    HP XP Con1

    Linksys 932 Postes

    UPS 600v Con1

    Linksys 936 Postes

    then I want the number of each product by'IdCategorieChild '

    like this resultats

    IdCategorieChild |Count

    -------------------------

    HP Vista 1

    HP Vista 1

    UPS 1

    Linksys 932 1

    Linksys 936 1

    and Thx

  • ma.daissaoui (9/14/2009)


    I have the following tables Categorie and ProductCateg ,CategorieChild

    table CategorieChild ====> IdCategorieChild | Idcategorie

    -----------------------------

    HP Vista | Con1

    HP XP | Con1

    UPS | Con1

    Linksys Postes

    Table Categorie ==> Idcategorie | Name

    --------------------

    Con1 N1

    Postes N2

    table ProductCateg ==> IdProductCateg | Idcategorie

    ----------------------------

    HP Vista Con1

    HP XP Con1

    Linksys 932 Postes

    UPS 600v Con1

    Linksys 936 Postes

    then I want the number of each product by'IdCategorieChild '

    like this resultats

    IdCategorieChild |Count

    -------------------------

    HP Vista 1

    HP Vista 1

    UPS 1

    Linksys 932 1

    Linksys 936 1

    and Thx

    I'm not sure I understand the question, but are you looking for an aggregate count of each unique value of the category? If so, I'd suggest you look up the phrase GROUP BY in the Books Online. That and the phrase COUNT() will get you what you need.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • thx

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply