1
Answer

count product in sqlserver use PARTITION BY

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)
0
Laxmidhar Sahoo
NA 2.3k 1.4k 7y
<b> Report Date:&nbsp;&nbsp; 2016-11-21 &nbsp;&nbsp;Optometrist: &nbsp;&nbsp;start &nbsp;&nbsp;Time:&nbsp;&nbsp; Consultant: &nbsp;&nbsp;Dr.suresh</b>
0
Midhun T P
NA 19.7k 281.2k 7y
Hi,
 
Please try below query - 
  1. DECLARE @x XML = '<table WIDTH="100%" CELLPADDING="1" CELLSPACING="1">  
  2.    
  3. <tr style="COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 10pt;BACKGROUND-COLOR: #f2f2f2;">  
  4.    <td><b>Report Date : </b>2016-11-21 </td>  
  5.   <td><b>Optometrist : </b> </td>  
  6.   <td><b>Start Time : </b> </td>  
  7. </tr>  
  8.    
  9. <tr style="COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 10pt;BACKGROUND-COLOR: #f2f2f2;">  
  10.         <td><b>Consultant : </b>Dr.Suresh </td>  
  11. </tr>  
  12.    
  13. </table>'  
  14.   
  15. SELECT t.c.value('.''NVARCHAR(MAX)')  
  16. FROM @x.nodes('*') t(c)  
 
Reference :
https://stackoverflow.com/questions/38868364/sql-remove-all-html-tags-in-a-string