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 an inconsistent dependency?
What are the different schemas objects that can be created using pl/sql?
How many types of literals are available in pl sql?
Can we connect to postgresql using sql developer?
What does a pl/sql package consist of?
What is substitution variable in pl sql?
how would you write a query to select all teams that won either 2, 4, 6 or 8 games? : Sql dba
Does a user_objects view have an entry for a trigger?
What is the syntax and use of the coalesce function?
What is before and after trigger?
What are the benefits of pl sql?
Explain the update statement in sql
What are stored procedures in mysql?
what are the maximum number of rows that can be constructed by inserting rows directly in value list? : Transact sql
Does execute immediate commit?