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
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 the best sql course?
how to start mysql server? : Sql dba
Is primary key always clustered index?
Is inner join faster than left join?
what are all the common sql function? : Sql dba
Can delete statement be rollbacked?
If a cursor is open, how can we find in a pl/sql block?
Do we need to rebuild index after truncate?
Is primary key clustered index?
what are the advantages of sql ? : Sql dba
how to escape special characters in sql statements? : Sql dba
Hi am new to PLSQL & facing problems in writing code like in SP, Functions, so any one having some SP coding with in depth explanation please share with me my Email ID suvarnaatsuvarna@rediffmail.com Or taking tanning on this please do contact me
What is your daily office routine?
what are aggregate and scalar functions? : Sql dba
what is schema? : Sql dba