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 use having without group by in sql?

986


What is view explain with example?

935


What is a record in a database?

1064


What program will open a mdb file?

969


What is data type in sql?

967


what is the difference between a web-garden and a web-farm? : Sql dba

1081


Explain about various levels of constraint.

949


What is the purpose of cursors in pl/sql?

1138


Write a sql query to find the names of employees that begin with ‘a’?

1015


Why do we use cursors?

990


Advantages and disadvantages of stored procedure?

1122


Mention what are the benefits of pl/sql packages?

1084


Is left join and outer join same?

1073


Is it possible to create the following trigger: before or after update trigger for each row?

1289


How we can create a table in pl/sql block. Insert records into it? Is it possible by some procedure or function? Please give example?

1055