adspace
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 current version of sql?
Can delete statement be rollbacked?
Does group by remove duplicates?
What is your daily office routine?
How do I remove duplicates in two columns?
what are all the common sql function? : Sql dba
what is schema? : Sql dba
Is primary key clustered index?
Do we need to rebuild index after truncate?
define sql insert statement ? : Sql dba
how to use regular expression in pattern match conditions? : Sql dba
What is the best sql course?
how many tables will create when we create table, what are they? : Sql dba
Can we use distinct and group by together?
What is the current version of postgresql?