1

I have 2 table and there's a column which contains comma separated value and I want to count all same value of that column, here's the sample table:

Client table 
ID | Name | Procedure 
1  | Joe  | Samp1,Samp2 
2  | Doe  | Samp1,Samp2,Samp3  
3  | Noe  | Samp1,Samp2

Desire Output 
Summary table ( For Procedure ) 
ID | NAME  | COUNT 
1  | Samp1 |  3 
2  | Samp2 |  3 
3  | Samp3 |  1 

Now, do you have any idea or suggestion so i can make it happen ? like add new table or is this possible with single query ?

PravinS
  • 2,640
  • 3
  • 21
  • 25
Newbie
  • 33
  • 4

1 Answers1

0

Try this query

SELECT LENGTH(COLUMN) - LENGTH(REPLACE(COLUMN, ',', '')) FROM TABLE_NAME
PravinS
  • 2,640
  • 3
  • 21
  • 25