Hai,
I need to display count of each text occurrence on all rows from a particular column.
See result below:
Here I have a set of Tags, I need to display count each tag as column in the name 'Total'
What I have done is:
- DECLARE @tags VARCHAR(8000)
- DECLARE @tot INT
- select @tags = coalesce(@tags + ',' , ' ') + Labels from addNew
- select @tot = count(@tags)
- select a.Labels as Tags,@tot as Total from addNew a
- inner join addNew n
- on a.Labels = n.Labels
- group by a.Labels
the result must be:
Please suggest your queries to get my desired result.
Thank in Advance.