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 not equal in sql?
What is consistency?
What are the different operators available in sql?
Is nosql faster than sql?
What are the query optimization techniques?
What is sql clause?
What is java sql driver?
Is pl sql and postgresql same?
Can we change the table name in sql?
What is the difference between sql and t sql?
What are all the common sql functions?
how can you see all indexes defined for a table? : Sql dba
What are properties of the transaction?
What does subquery mean in sql?
how can we know the count/number of elements of an array? : Sql dba