Devendra  Kumar

Devendra Kumar

  • NA
  • 517
  • 245.3k

count product in sqlserver use PARTITION BY

Apr 12 2016 6:31 AM
count product by shape:
 
use this query:
 
select tbl_shape.Shape +' ('+ltrim(str((select COUNT(1) from tbl_Image_Master where tbl_Image_Master.Shape_Id=ShapeId)))+')'
as Shape_Name From dbo.tbl_shape group by tbl_shape.Shape,tbl_shape.shapeId ORDER BY tbl_shape.Shape Asc
 
this is give output like:
        Shape_Name
  • Box and Bricks (31)
  • Chips (26)
  • Coin (19)
  • Fancy (11) 
but in this result some product name and image same
i want count only one that have same name and image
 
what it is possible
please solve this query 
 

Answers (1)