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
What is the difference between clustered and non-clustered indexes?
what are the authentication modes in sql server? : Sql dba
How to avoid duplicate records in a query?
Why use triggers in sql?
What is raw datatype in sql?
What is a Mapplet?
Is clustered index a primary key?
how to create a new table by selecting rows from another table in mysql? : Sql dba
How can you save or place your msg in a table?
What are the three forms of normalization?
How to display the current date in sql?
what is the difference between undefined value and null value? : Sql dba
what are string data types? : Sql dba
What is the difference between unique and primary key constraints?
How to combine two stored procedures in sql?