TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guruprakash C
NA
142
27.9k
Individual count of text from a column
Oct 5 2017 2:53 PM
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.
Attachment:
SQLQuery.rar
Reply
Answers (
2
)
A severe error occurred on the current command
Please help me to optimize below stored procedure