need to split a string into separate values.
eg.
col1 col2
----------
100 - 'a,b,c'
200 - 'a,x,d,e'
300 - 'c'
result:
value count
-------------
a - 2
b - 1
c - 2
etc.
Answer Posted / sharath
select count(substr('a,b,c',',',instr('a,b,c',',',1,1)-1))
,count(substr('a,b,c',instr('a,b,c',',',1,1)+1,instr
('a,b,c',',',2,1)-instr('a,b,c',',',1,1)-1))
,count(substr('a,b,c',instr('a,b,c',',',2,1)-1)) from
table_name;
Is This Answer Correct ? | 0 Yes | 4 No |
Post New Answer View All Answers
What is memory optimized table?
What do we need to check in database testing?
How many joins in sql?
How do you concatenate in sql?
What is the difference between joins?
Explain aggregate functions are available there in sql?
How many triggers can be applied on a table?
How does a self join work?
what are the differences between char and varchar? : Sql dba
What is java sql package?
Can there be more than one function with a similar name in a pl/sql block?
what is the difference between mysql_fetch_array and mysql_fetch_object? : Sql dba
What is on delete restrict?
What are the indexing methods?
What is data type in sql?