I stuck on this I write SQL to show a count of product
Example
I need them to show like this
I have 12 Pieces of Product
I show them on "Textbox1" as all product
then the second "Textbox" I need to show "Registered Product" (Registered Product is count from binary 0 - 1 that is 0 = Approved 1 = not approved)
like this
All Product = 12
Registered = 6 (All Product(12) - Registered Product(6)
Then it will expanded the product to a category like this
FOOD : 2
USES : 2
TAILOR : 2
now I just can show the
All product then expanded 12 products to a category
i'm stuck on
1.how can I count a registered product by Stored procedures (T-SQL)
2.how can I expanded them to a category
I had write a code to show them like this
select count(T.[ProductName]) as ProductCount,
T.CategoryID,
T.estbProducerID,
T.NewProducer,
T.[ProductCountAll]
from (
select tn.[ProductName],
tn.[CategoryID],
tp.estbProducerID,
tp.NewProducer,
count(*) over() as [ProductCountAll]
from [tpdcn] tp,[tpdtn] tn
left join [tpdcn]
on tn.parentid = tpdcn.libDocumentID
where tp.libdocumentID = @id
) as T
group by T.[CategoryID],
T.estbProducerID,T.NewProducer, T.[ProductCountAll]
END
it's show
ProductCount CategoryID estbProducerID NewProducer ProductCountAll
4 1 2 1 12
3 2 2 1 12
2 3 2 1 12
2 4 2 1 12
1 5 2 1 12
FOOD = 4
TAILOR = 3
USES = 2
EX1 = 2
Ex2 = 2
ex3 = 1