Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Counting the frequency of characters on 1 row across columns

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-31 : 07:41:57
Div writes "I have 8 columns consisting of 1 letter each.I want to be able to count the number of times that the letter 'a' or 'b' until 'z' occurs in one record. For example, for record number 1, the following information is available:

Column 1: a
Column 1: k
Column 1: t
Column 1: s
Column 1: a
Column 1: d
Column 1: d
Column 1: k

I want to be able to see that for this record there are 2 occurences of 'a',2 occurences of 'k', 1 occurence of 't', etc.
Please help!!

I'm using SQL Version 8.0 and Windows XP Professional.
Thank you!
Divya"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-31 : 07:53:09
Is this?

Select column1, count(column1) from yourTable group by column1

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -