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 sn
substr('a,b,c',',',instr('a,b,c',',',1,1)-1)
,substr('a,b,c',instr('a,b,c',',',1,1)+1,instr
('a,b,c',',',2,1)-instr('a,b,c',',',1,1)-1)
,substr('a,b,c',instr('a,b,c',',',2,1)-1);
| Is This Answer Correct ? | 2 Yes | 5 No |
Post New Answer View All Answers
Can you upgrade sql express to full sql?
What does stand for in sql?
Can I copy :old and :new pseudo-records in/to an oracle stored procedure?
What is the difference between clustered and non-clustered index in sql?
How to select random rows from a table?
what is the difference between mysql_fetch_array and mysql_fetch_object? : Sql dba
What is difference between function and trigger?
Can we use views in stored procedure?
Can we create view in stored procedure?
how to drop an existing index in mysql? : Sql dba
what are the differences between procedure-oriented languages and object-oriented languages? : Sql dba
how to shutdown mysql server? : Sql dba
What is the need of a partition key?
How do I start pl sql?
Are views faster than queries?