?
Solved

count repeating words and total

Posted on 2006-04-07
3
Medium Priority
?
1,335 Views
Last Modified: 2012-05-05
I have a table with a single column that is used to collect search words.
What I want to do is total up the number of times each word appears, ex:
      avator
      avator
      avator
      anator
      shaker
      shaker
      gamma
      gamma
      gamma
I want to make a list of the words with a count of how many like this:
avator  3
anator  1
shaker  2
gamma 3

can I do this with sql or should I do this in code?  thanks

0
Comment
Question by:MikeMCSD
3 Comments
 
LVL 14

Assisted Solution

by:adwiseman
adwiseman earned 1000 total points
ID: 16403363
Select Word, COUNT(*) as [Count of Word]
FROM MyTable
group by Word
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 1000 total points
ID: 16403373
SELECT Distinct Word, COUNT(*) as [Count]
FROM urTable
GROUP BY Word
0
 
LVL 16

Author Comment

by:MikeMCSD
ID: 16403715
perfect, thanks guys
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question