Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Can we create view in stored procedure?

908


Explain what is a subquery ?

1118


What does subquery mean in sql?

988


Can you join views in sql?

896


what is a table in a database ? : Sql dba

989


What is use of package in pl sql?

948


How do you create a unique index?

985


Explain the difference in execution of triggers and stored procedures?

966


How to prepare for oracle pl sql certification?

1007


GLOBAL TEMPORARY TABLE over Views in advantages insolving mutating error?

3007


what are the advantages of using stored procedures? : Sql dba

1058


Is there a way to automate sql execution from the command-line, batch job or shell script?

917


What are views in sql?

925


What is the difference between numeric and autonumber?

938


Is coalesce faster than isnull?

906