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
Which operator is used in query for pattern matching?
Can we insert delete data in view?
Can pl sql procedure have a return statement?
What is before trigger?
What are tables in sql?
What are the different types of triggers?
What are the benefits of stored procedures?
Where is sql database stored?
What is cold data?
What are the different tcl commands in sql?
what's the difference between a primary key and a unique key? : Sql dba
Explain scalar functions in sql?
What are three advantages to using sql?
What is the use of partition by in sql?
What is the left table in sql?