Hello everyone,
i have this query and count(artikel.artikelid) returns 2 instead of 3. i know why, because i have the artikelid twice (8135) in the 'where in...' part but i would like it to return 3
here is my problem query:
SELECT cg.CategorieGroepID,
cg.GroepsNaam,
cg.BenodigdAantal,
cg.ActieCatId,
cg.ActieActief,
count(Artikel.ArtikelID)
FROM CategorieGroep cg INNER JOIN
Categorie ON cg.CategorieGroepID = Categorie.CategorieGroepID INNER JOIN
Artikel ON Categorie.CategorieID = Artikel.CategorieID
where artikel.artikelid in(8135,8135,7914)
group by cg.CategorieGroepID,
cg.GroepsNaam,
cg.BenodigdAantal,
cg.ActieCatId,
cg.ActieActief
too clear things up, the where artikel.artikelid in(8135,8135,7914) part is meant to be used later for a dynamic array of artikelid's
people can have the same artikelid twice and then the query should return 2 instead of one. i am sorry if my question is not totally clear.
it is meant for building an overview of a users shoppingbasket. people can order artikelid 8135 (for instance) twice or even more and the query should return the amount of products by main categorie